Hello,
I'm having strange inconsistencies in trying to access MySQL.
I have a user and database set up. The user I created has all privileges to the database.
Through phpMyAdmin, I can log in as the user and see/edit the database and the one table I have in it.
The problems start when I access MySQL through my own PHP script (using MySQLi).
From my PHP script, I can create a MySQL connection using the root user and one of the default databases. However, when I try to create a connection with the other user account (same one that can access MySQL through phpMyAdmin), I get the 1045 access denied error. Even more surprising, if I create a database through phpMyAdmin while logged in as root and then try to connect to it through the PHP script (again, as root), I get the 1049 unknown database error.
When using phpMyAdmin, everything seems fine, even including newly created users and databases. But when using my own PHP script, there's a problem with anything newly created (i.e., other than root user and default databases).
Any suggestions on what might be going on?
More info:
Windows 10, 64 bit
WampServer 3.2.0, 64 bit
Apache 2.4.41
PHP 7.3.12
MySQL 8.0.18
WampServer icon: green
Access to localhost: yes
Access to phpMyAdmin: yes
Antivirus: Kaspersky
WampServer path: C:\wamp64
I'm having strange inconsistencies in trying to access MySQL.
I have a user and database set up. The user I created has all privileges to the database.
Through phpMyAdmin, I can log in as the user and see/edit the database and the one table I have in it.
The problems start when I access MySQL through my own PHP script (using MySQLi).
From my PHP script, I can create a MySQL connection using the root user and one of the default databases. However, when I try to create a connection with the other user account (same one that can access MySQL through phpMyAdmin), I get the 1045 access denied error. Even more surprising, if I create a database through phpMyAdmin while logged in as root and then try to connect to it through the PHP script (again, as root), I get the 1049 unknown database error.
When using phpMyAdmin, everything seems fine, even including newly created users and databases. But when using my own PHP script, there's a problem with anything newly created (i.e., other than root user and default databases).
Any suggestions on what might be going on?
More info:
Windows 10, 64 bit
WampServer 3.2.0, 64 bit
Apache 2.4.41
PHP 7.3.12
MySQL 8.0.18
WampServer icon: green
Access to localhost: yes
Access to phpMyAdmin: yes
Antivirus: Kaspersky
WampServer path: C:\wamp64