Windows 7 PHP MySQL Connection Issues [duplicate]

可紊 提交于 2019-12-05 13:57:27

Check old_passwords option in your my.cnf file.

http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_old-passwords

If for whatever reason you can't switch to new passwords, you can't use mysqlnd as your MySQL driver, and need to switch back to the older one.

Some more information about mysqlnd

http://dev.mysql.com/downloads/connector/php-mysqlnd/

Regarding the error posted in your edit, I had been getting the same error on Windows 7 using PHP 5.3.5 when connecting to MySQL 5.0.45 on Linux. The solution for me was to disable "old_passwords" in my.cnf AND run

set password = password('my password');

The error message doesn't make it clear that you have to do both steps in order to fix the problem. Hope this helps.

when you want to change your password and the server keeps on generating 16 bytes hashes, you may try as following:

1) generate 41bytes hash by yourself (using some hash generator website) for example password: 'qwerty' hash: 'aa1420f182e88b9e5f874f6fbe7459291e8f4601'

2) change the password SET PASSWORD FOR 'username' = '*aa1420f182e88b9e5f874f6fbe7459291e8f4601'

now you should be able to connect to the database using the new authentication method

I tried just about everything listed here (and elsewhere) to no avail till I found this:

SET old_passwords = 0; UPDATE mysql.user SET Password = PASSWORD('testpass') WHERE User = 'testuser' limit 1; SELECT LENGTH(Password) FROM mysql.user WHERE User = 'testuser'; FLUSH PRIVILEGES;

Drop that into your mysql client or phpmyadmin and change the testpass to your DB login password and the testuser to your DB login user, execute query. Great success! problem solved.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!