Answer the question
In order to leave comments, you need to log in
Connecting to old mysql database from new php
Hi Habr!
There is such a problem. On one of the servers there is a website, there is a database. There, php and mysql are old, they work fine. There is another server. Where everything is new. It is necessary to connect somehow from the new server to the old database. At the same time, it is impossible to change and update the password hash to a new one. Is there a way to do this without installing older versions of php?
PDO writes an error
SQLSTATE[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
; all solutions found in search engines come down to updating the hash in the database itself. Is there any way to do without it?
Answer the question
In order to leave comments, you need to log in
How old is MySQL, which particular version? If it's still 4.1 or higher, but just using the old authorization. That is the easiest option to get another user with access to the required database and new authorization, and use this new user from the new site, while the old scripts will run under the old user.
You can make a communication system (via xml), then the old one will work as it did, and the new one will connect to the old database via xml, if you only need to check if the user entered the password correctly.
but I would also do this:
- if the user has not yet received a new password - connect to the old one, if successful - generate the correct password in the new database for the user and make subsequent connections using the new database
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question