0

I have this shared account on Hostgator. Using PHP 7.1 and mysqli_connect, I have no issue connecting to the MySQL 5.3.36 database. The PHP script should be fine. The hosting company sent me an email to let me know they will support PHP 7.4 and they will remove all older versions in a month. I then switched the account to PHP 7.4. The Wordpress blog needed some tuning, but it is now working with PHP 7.4. The other database I use for a dynamic file catalogue won't connect using PHP 7.4. I am getting the following error message:

The server requested authentication method unknown to the client

According to my searches, it seems the culprit is the MySQL authentication plugin and MySQL won't handle password properly for that reason. I would try to fix that, but it looks that I can't change the plugin (mysql_native_password) from my account and the host company tech support could care less about my issue. Their best answer was to downgrade PHP to 7.1. It is a quick fix, but it won't work after they remove it in a month. I could also move the site elsewhere or use a remote database, but does anyone know an actual way to fix that bug and have everything there working?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Jeff
  • 34
  • 2
  • [This post](https://stackoverflow.com/questions/59461990/php-7-4-and-mysql-connections) from december 2019 seems to describe the same problem. An answer is give there ( for MySQL 8.0). – Luuk Dec 21 '20 at 07:03
  • Please enable proper error reporting. You should see an additional warning that will tell you which authentication method was requested. Based on that you have to look for a solution. See [How to get the error message in MySQLi?](https://stackoverflow.com/a/22662582/1839439) – Dharman Dec 21 '20 at 15:26
  • Can you also tell which exact PHP version are you using? – Dharman Dec 21 '20 at 15:32
  • @Dharman The exact PHP version is 7.4.137.4.13. I tried to connect into MySQL in terminal. I can open a session, but it is a jailed access. I can't modify root. – Jeff Dec 22 '20 at 05:44
  • @Luuk If I use `mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);` before `mysqli_connect` it won't give anything. If I use `mysqli_connect_errno` and `mysqli_connect_error`, I am getting 2054 and the error message above. – Jeff Dec 22 '20 at 05:49
  • Try this: https://dba.stackexchange.com/questions/33447/connect-error-2054-mysql-old-password-issue-still-not-solved – Luuk Dec 22 '20 at 07:22
  • This doesn't sound right. It could be a bug. Can you please tell us which authentication method was requested? Check your error logs, maybe you will have more details there. – Dharman Dec 22 '20 at 13:15

1 Answers1

0

After using mysql in terminal, I reviewed my user passwords and I got a "password needs to be 41 character hash" error message. I simply changed my passwords and it is now working. It seems that something has changed in how passwords are stored or the bug was fixed. Thanks.

Jeff
  • 34
  • 2