I try to remotely connect to a MySQL server online from my local machine, but I get the following error:
Warning: PDO::__construct(): The server requested authentication method unknown to the client [mysql_old_password] in C:\xampp\htdocs\ticket\terminal\sync.php SQLSTATE[HY000] [2054] The server requested authentication method umknown to the client
My local version of MySQL server is 5.5.27, libmysql is mysqlnd 5.0.10. The remote version of MySQL server is 5.5.23, the mysqlnd version is not displayed.
I assume this is an incompatible password hash problem, but I don't know how to resolve it. The following is part of the connection code
$dsn = 'mysql:host=184.173.209.193;dbname=my_db_name'; $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', ); try { $online_dbh = new PDO($dsn, 'myusername', 'mypassword', $options); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Congratulations!"; } catch (PDOException $e) { echo $e->getMessage(); }
mysql pdo database-connection remote-access
Chibuzo
source share