Mysql – Is it possible to connect to MySQL from PHP using the old password encryption protocol

MySQLPHP

I am working on a front-end project with a legacy system. I have to access a MySQL 5.6.25 database, which is still using the old pre-4.1 password encryption protocol. In particular I have to write a PHP/Slim api that implements CRUD operations with this database. I have to use PHP 5.3.

Is it possible to connect to the MySQL DB from PHP using the old password encryption protocol? So far I tried the php extensions mysql and mysqli, but they both use the post 4.1 password encription.

I know that the pre-4.1 password encryption protocol is very old, not secure, and should be upgraded. But this is not something I have control on in this project, so I have to find a way to work with this constraint.

Best Answer

Do you have the option to rebuild PHP without mysqlnd?

If your current build is using it then it'll flat out refuse to have anything to do with the old authentication method and you'll be getting an error along the lines of "mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication" in your logs. A build without it might just get you thru, if its an option for you.