Cryptic MySQL error

Today as I was attempting to test one of my PHP applications, I received this error after attempting to connect to a MySQL database:

Warning:  mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter
than expected in index.php on line 29

Warning:  mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to
MySQL 4.1+ using old authentication in index.php on line 29

The script giving the error was running on OS X 10.6.4 with the stock PHP 5.3.1. After doing a bit of searching and reading the MySQL documentation on the old password format, I was a bit confused because I ran this on the server:
[user@host ~]# rpm -q mysql mysql-server
mysql-5.0.77-4.el5_5.3
mysql-server-5.0.77-4.el5_5.3

Both the server and client should support the new authentication version, which was introduced all the way back in MySQL 4.1. So why wouldn't it connect?

It turns out that CentOS 5 disables the new password hashes by default in favour of remaining compatible with 3.x (and earlier) MySQL clients. All you have to do is edit /etc/my.cnf and comment the old_passwords=1 line. After restarting the server, you should notice that running SELECT PASSWORD('foobar'); in a MySQL prompt will return 41-character hashes, not the old-style 16 character hashes. Reset the user passwords to start using the new hashes and you'll be good to go.

Rating: 

Comments

The same problem was occurred for me few months back while doing my project testing. I got to know from essay services articles that here the main problem is when you run any application in Mysql server that application platform must be same as of the server platform. Hear OS don`t play any role because the application is installed in server so it take sever OS flies as backend files and try to run that application. It better to see that the application has same platform as of server.

It is best to appointment Cheap oakleys for refined, admirable Ray Ban frames accepting a airy feel, but see to it that they're affiliated abiding and durable. It's aswell astute to emphasis for blemish aggressive contacts with 100% UV aegis to aegis your eyes.The artisan cast Ray Ban was founded with a 21 year old Jones Ray Ban in 1856 who had been a aloft draper's newbie. Thomas began his career accepted by breach up their own bazaar amidst in Basingstoke, Hampshire that specialised in cheap Ray Bans affairs water-resistant overcoats. The bazaar apprenticed grew to become accepted and acclaimed because of its top aloft garments. Thomas Ray Ban was the artisan who consistently admired able abstracts and acclimatized how aloft was of according replica oakleys emphasis aback the artful style. He were able to amalgamate the two and his cachet like a artisan was apprenticed aloft because of these factors at http://www.getoakleysunglasses.co.uk and their amore for design.