MySQL connection using old (pre-4.1.1) authentication protocol refused

This week, I’m faced with this problem “authentication protocol refused” when using php connect to mysql server through remote connection.

The full error is “Connection using old (pre-4.1.1) authentication protocol refused (client option ‘secure_auth’ enabled)”.

I was trying to connect by terminal and the problem doesn’t appear.  After some hours for searching, finally I found the way to fix this without control the mysql server.

To fix “authentication protocol refused” First, login to your mysql (You can use terminal or phpMyAdmin)

If you choose terminal to login, use mysql command to connect, Exp:

mysql -h mysqlhostname -u mysqlusername -p

Then, after logged in. run these queries:

SET SESSION old_passwords=FALSE;
SET PASSWORD = PASSWORD('[your password]');

Note: queries above will not affect to your database.

That’s all, now try to connect your remote mysql by php. It work perfectly with me, hope this short tutorial will work with you too.

Source: Stackoverflow

I'm 26 years old, a web developer from Nha Trang, Viet Nam. I love travelling and listen to rock music all day. This site is where I share my knowledges, my moments and some stuff...Wanna drink some beer? Feel free to contact me at the footer.

Leave a Reply