Hi all,
After installing CodeIgniter 4, the next important step is setting up your database connection. Here’s how you do it:
- Open
Code:
app/Config/Database.php
file.
- Update the
group settings with your database credentials (hostname, username, password, database name).
- Make sure the database driver matches your DBMS (e.g., MySQLi for MySQL).
- Save the file and test your connection by running a simple model query.
If you want to use environment variables for better security, CodeIgniter supports that too! Just edit the
file at the root and set your DB credentials there.
Let me know if you want me to share sample code snippets or troubleshoot errors.
Cheers!