MySQL 5.5 PDO::__construct(): The server requested authentication method unknown to the client [mysql_old_password]


mysql-poweredJust upgrade one of my MySQL from 5.0 to 5.5 using WHM MySQL Upgrade tools. The upgrade went smooth. Right after i think everything is ok, some of my website show error while performing db query “Warning: PDO::__construct(): The server requested authentication method unknown to the client [mysql_old_password]”. That website is being developed using an old symfony 1.4 framework. I can see many people are facing the same problem and there are various solution. And i found one that works for me and i’m going to show it here.

To solve: MySQL 5.5 – PDO::__construct(): The server requested authentication method unknown to the client [mysql_old_password], follow the steps below:-

Advertisements

  • First login to your mysql server using the problem username and run this query
    SELECT PASSWORD('PUT_THE_USER_PWD_HERE');
  • Once you run the query, you should see there is only 16 character shown.
  • Now edit your /etc/my.cnf file and comment out the “old_passwords=1” (Do not delete, just comment using #, you need to uncomment it later)
  • Now restart your mysql service
  • Once mysql service restarted, reset the user password
    SET PASSWORD FOR 'theuser'@'localhost' = PASSWORD('put-his-user-here');

    Once set, run this query again:-

    SELECT PASSWORD('PUT_THE_USER_PWD_HERE');

    and you should see the password being shown is 41 characters.

  • now edit /etc/my.cnf again and uncomment the “old_passwords=1” and save
  • restart your mysql service now and the user should be able to login now!

Note:-
Actually you should disable the old_passwords=1 as it’s a very old flag that is not being used for quite a long time (this is being use for pre-4.1 format) especially if your mysql server by default does not use 16-byte passwords, then i think you can safely disable this flag.




Share this with your friends:-

Leave a Reply