Authentication problem on access MySQL from PHP

42 Views Asked by At

I'm moving an old application between two windows server (see data below).

I keep attention to have php.ini, my.ini, httpd.conf, httpd-vhosts.conf alligned.

I know, PHP version is too old and even worse the code use mysql_connect.

On the old server the instruction mysql_connect('localhost', 'root', 'my_password'); works without problems.

On the new server the same istruction gives Access denied for user 'root'@'localhost' (using password: YES).

If I call the function without password, the connection works.

I access phpmyadmin with root and my_password.

User root has Password YES, Global privileges ALL PRIVILEGES, Grant YES.

Someone have a suggestion (other than upgrade PHP and connection library) where to look for the problem?

Systems setup:

Old server

  • Windows Server 2008 R2 Enterprise
  • Apache 2.4.23
  • PHP 5.6.25
  • MySQL 5.7.14

New server

  • Windows Server 2019 Datacenter
  • Apache 2.4.41
  • PHP 5.6.40
  • MySQL 5.7.28
1

There are 1 best solutions below

0
mYmage On

After looking around for a while and doing some test, I used the "workaround" to uninstall wamp and reinstall the exact same version (wamp server 3.0.6 with 3.0.8 update) and align the config files.

Now the app goes without problems.