Skip to content
Advertisement

Why I can’t connect to a MySQL 5.3.36 shared server using mysqli_connect and PHP 7.4, but it will work using php 7.1?

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?

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement