I am attempting to connect with a mySQL database at http://bluesql.internet, however when I attempt for connecting, it gives this error:
Connect Error (2000) mysqlnd cannot connect with MySQL 4.1+ using old authentication
I have investigated this, and contains related to some old password plan used before MySQL 4.1. More recent versions have the choice to make use of old passwords, which I have read could cause this issue.
I am running php 5.3, and hooking up with mySQLi (new mysqli(...)). I am wishing I'm able to make a move within the code for connecting towards the DB at bluesql.internet - clearly I do not control how their database is to establish. Downgrading php versions is not a choice.
Anybody have ideas?
edit: This only is applicable if you're in charge from the MySQL server... if you are not have a look at http://stackoverflow.com/questions/1892607/mysql-password-hashing-method-old-versus-new
First seek advice from the SQL query
SHOW VARIABLES LIKE 'old_passwords'
(within the MySQL command line client, HeidiSQL or whatever frontend you prefer) if the server is placed to make use of that old password schema automatically. If the returns old_passwords,From you just have old password records within the
customers tables. The MySQL uses that old authentication routine of these accounts. But you can just set a brand new password for that account and also the new routine is going to be used.
You should check which routine will be utilised by considering the
mysql.customers table (by having an account that can access that table)
Choose `User`, `Host`, Length(`Password`) FROM mysql.user
This can return 16 for accounts with old passwords and 41 for accounts with new passwords (and for accounts without any password whatsoever, you might like to take proper care of individuals too).
Either make use of the user managements tools from the MySQL front-end (if you will find any) or
SET PASSWORD FOR 'User'@'Host'=PASSWORD('yourpassword') FLUSH Rights
(replace User and Host using the values you' got in the previous query). Then check the size of the password again. It ought to be 41 now and mysqlnd should have the ability to connect with the server.
I simply had this problem, and could deal with it.
First, connect with the MySQL database by having an older client that does not mind old_passwords. Connect while using user that the script is going to be using.
Run these queries:
SET SESSION old_passwords=FALSE SET PASSWORD = PASSWORD('[passwords]')
Inside your PHP script, improve your mysql_connect function to incorporate the customer flag 1:
define('CLIENT_Lengthy_PASSWORD', 1) mysql_connect('[your server]', '[your username]', '[passwordsA, false, CLIENT_Lengthy_PASSWORD)
This permitted me for connecting effectively.
On OSX, I made use of MacPorts to deal with exactly the same problem when hooking up to my siteground database. Siteground seems to become using 5..77mm0.1-log, but developing a new user account did not repair the problem. This is exactly what did
sudo port install php5-mysql -mysqlnd +mysql5
This downgrades the mysql driver that php uses.
You may want to switch in the mysqlnd driver towards the previous mysql driver. This most likely calls for recompiling PHP, but as is available noted downgrading is not a choice, you will possibly not have the ability to pull that off either.
Had exactly the same problem, but performing the queries alone won't help. To repair i did the next,
- Set old_passwords= during my.cnf file
- Restart mysql
- Login to mysql as root user
- Execute FLUSH Rights