I'm struggling with my hosting company and have had to move to a new one fairly quickly. I've transferred the pages and the databases over quite easily, but have run into an unexpected problem in the form of the error message below.

Warning: mysqli_connect(): (HY000/2000): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file in <linktomysqlloginhere> on line 1

I use adminer, and have logged in, clicked the SQL Command link and pasted the SET PASSWORD command as above, replace the password text with my current MYSQL login. When I click execute, I get the message, "Query executed OK, 0 rows affected."

I think this is down to the new host using a more up to date version of MYSQL (I left my old hosting company due to poor MYSQL performance) but I have to confess to complete ignorance on what this means and how to resolve it.

Is anyone able to point me in the right direction?

Many thanks.

Hi, run:

SELECT `User`, `Password`, length(`Password`) FROM mysql.user;

The length should be 41, if you get 16 it means that the user is still using the old password system and it needs to be updated. And you have to make sure the system variable old_password is set to 0, otherwise using PASSWORD() will return the same result of OLD_PASSWORD().

More information at:

Adjust the links according to your current MySQL version, as there could be some differences.

Many thanks. I failed to mention - and I'm not sure if this is relevant - that I'm on shared hosting - is correcting this issue something I can achieve or do I need to speak to the hosting company?

I put your code into the adminer command link pane but received the message, "Error in query (1142): SELECT command denied to user" which made my question above suddenly dawn on me...

Uh, yes you need the correct privilege in order to perform these changes. Open a ticket with the hosting company and point them to the error message you got from mysqli_connect(), they can fix the issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.