[Solve in 3 steps!] packet 6 bytes shorter than expected – mysqlnd cannot connect to MySQL 4.1+ using old authentication
Weird, huh?
I'll explain you in 3 steps how to solve it! (trust me!)
Ok, I thought the same than you when I get this message.
I had a script that makes two connections to two servers.
I was using the "second" server from my client application and it was working perfectly, so what happened!?
I've read many posts that said me to re-install PHP and or MySQL. What the heck!? No way!
Those are production servers, tenths of thousand kilometers from here, and are working. I simply can't.
Ok, here is the short 3-steps guide (then will explain you why)
1. Turn off the old_passwords compatibility in MySQL
-
SET @@old_passwords = 0
2. Recreate the password for the user
-
SET PASSWORD FOR 'username'@'hostname' = PASSWORD('your_pass')
3. Check for the new password's length (must be 41 instead of 16 and it hast to start with an asterisc)
-
SELECT
-
Length(`Password`),
-
Substring(`Password`, 1, 1)
-
FROM `mysql`.`user`
-
WHERE `user`= '<your_username>'
4. Breath again :)
Ok, but WHY?
I'm not going to burden explaining why PHP is not compatible with the old_passwords hashing method.
If you want to know the truth then you can Google for it.
Just let me tell you that simply creating a new user or a new password will not solve your problem until you don't turn off the old_passwords BEFORE changing it.
Hope this helps!
Pampa
