mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication

When you move MySQL from your hosting to Azure Database for MySQL and trying to connect to it – you can see something like this:

mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD(‘your_existing_password’). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file

On the internet, you can find some advice about setting a password or add a parameter like:

old_passwords=0

It can help with on-premise installation but, for Azure, the solution is to change PHP version to a higher for an example from 5.3.29 to 5.4.16 what is not a big minor change and application can connect to Azure Database for MySQL.


Kiedy przenosisz bazę MySQL z twojego hostingu do Azure Database for MySQL możesz spotkać się z poniższym błędem:

mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD(‘your_existing_password’). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file

W internetach znajdziesz podpowiedzi typu, zmiana hasła lub ustawienie parametru:

old_passwords=0

Powyższe może pomóc w bazach danych utrzymywanych na własnych serwerach, ale w moim przypadku dla Azure nie pomogło. Pomogła natomiast zmiana wersji PHP ze starego PHP 5.3.29 na 5.4.16.