Soit le script basique de connexion

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 $hostname_conn= 'localhost';
 $database_conn = 'ma_base';
 $username_conn = 'root';
 $password_conn = 'mdp';
 $conn = mysql_connect($hostname_conn, $username_conn, $password_conn);
Ce script fonctionne très bien sous PHP 5.2
Lorsque je bascule vers PHP 5.4 le script plante avec le message suivant :

Warning: 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 in /homepages/16/d154860034/htdocs/mon_appli/conn.php
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


Visiblement, un problème d'incompatibilité avec la nouvelle version de MySQL livrée avec mon paquet PHP 5.4.... mais je ne comprends pas tout

Comment dois-je corriger mon script pour qu'il fonctionne dans les deux versions de PHP/MySql ?

Merci à tous