Inconsistent Access to MySQL
Posted by: vmiller521 (---.nycap.res.rr.com)
Date: April 09, 2020 07:26PM

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

Options: ReplyQuote
Re: Inconsistent Access to MySQL
Posted by: Otomatic (Moderator)
Date: April 09, 2020 07:41PM

Hi,

Read, read, read what was recommended to read at the end of the installation of Wampserver, and read also which is repeated in the document, quoted at the end of the installation :
wamp(64)\instructions_for_use.rtf or wamp(64)\instructions_for_use.pdf

And then, be a little curious: Right-Click -> Help -> ...

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Inconsistent Access to MySQL
Posted by: vmiller521 (---.nycap.res.rr.com)
Date: April 09, 2020 09:31PM

Thank you, Otomatic.

Creating a virtual host did not solve my problem, but is still good to know.

I figured out the problem. I am using MySQL. It appears that WampServer uses the default port to connect to MariaDB instead. So, adding the MySQL port to the login code fixed the problem.

Options: ReplyQuote
Re: Inconsistent Access to MySQL
Posted by: Otomatic (Moderator)
Date: April 09, 2020 10:16PM

Hi,

You didn't read :
Right-click Wampmanager tray icon -> Help -> MySQL -MariaDB
and partucarly How to switch default DBMS

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.