Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Unable to connect to the database #3477

Closed
dimasoppo448 opened this issue Aug 10, 2020 · 5 comments
Closed

Bug: Unable to connect to the database #3477

dimasoppo448 opened this issue Aug 10, 2020 · 5 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@dimasoppo448
Copy link

Describe the bug
Please need help. I can't connect to the database not from model or manually connect. The database is exist. Try to change .env or config still doesn't work.

error:
SYSTEMPATH\Database\BaseConnection.php at line 425 (something about connID)
SYSTEMPATH\Database\BaseConnection.php : 646 — CodeIgniter\Database\BaseConnection->initialize ()

.env:
database.default.hostname = localhost
database.default.database = baru
database.default.username = root
database.default.password =
database.default.DBDriver = MySQLi

CodeIgniter 4 version
4.0.4, Mysqli driver

i have already follow the documentation and change hostname to 127.0.0.1 but still can't connect to he database.

  • PHP version 7.4.8
@dimasoppo448 dimasoppo448 added the bug Verified issues on the current code behavior or pull requests that will fix them label Aug 10, 2020
@lonnieezell
Copy link
Member

Most likely not a bug. Try changing localhost to 127.0.0.1.

In the future please ask for help on the forums, we use GitHub for tracking issues.

@dimasoppo448
Copy link
Author

change localhost to 127.0.0.1 doesn't help

@paulbalandan
Copy link
Member

You have not provided a password. Or you have not registered yet the root user to MySQL server.

@dimasoppo448
Copy link
Author

when i run in xampp project/public/ it can connect

and somehow when use spark serve i can't connect to the database

@paulbalandan
Copy link
Member

Try setting your logs threshold to 4 so that errors will be logged too. Then run the code again. Then tell us the ERROR line you get in your logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

3 participants