Converting mysql database for a new script

I been using an old script for the last 12 years that uses a mysql database. I installed a new script that uses mysql as well . I was able to convert the databse by exporting the database from phmyadmin in csv format and basiclly copying each colmn from old database to the new database and it worked just fine except the passwords.
the old passwords does not match the new ones.
anyone can help me fix this problem? maybe the old one is using different coding from the new one?

Take a look at the PhpMyAmin database Permissions. I think a new user and password need to be created.

Also worth mentioning that mysql is depreciated.
It would be a good time for you to convert to mysqli or pdo.
I switched to mysqli a while back, thinking pdo was a bit over my head.
But now I’m in the process of changing to pdo, for the added security of prepared statements, and finding it easier than I expected.

I may be off, but my take is that the problem isn’t the database owner password nor the use of the deprecated mysql_ functions.

There are differences in the way MySQL hashes password() in different versions of the database
http://dev.mysql.com/doc/refman/5.7/en/password-hashing.html

Also, PHP code can be written to hash passwords many different ways and store them in a “password” field in a query that does not use the MySQL password() function.

If I’m correct, the problem is
“mysecret” is translated to something like “j7hu9f5gnj”
in the old database password fields, but
“mysecret” is translated to something like “vg84fk9ugy64dm9443nj”
in the new database. i.e. Using “mysecret” will no longer work.

Hopefully password() was and is being used and it’s just a matter of running mysql_upgrade
http://dev.mysql.com/doc/refman/5.7/en/mysql-upgrade.html

The only time I did this with MySQL I simply exported the password text field as a regular field and import it again into the new database (again, as a regular text field)

My login script which sent the password hashed, worked perfectly.

The thing is… when you exported/imported this field… did you re-hashed it? Or is it whatever script that you’re using to see if the password introduced matched to the one in the DB using a different method to hash it? (or 256 bit encryption instead of 128 bit or something like that)

I exported the old database user table and new database user table as csv file.
then copied the password from old table and pasted into the new table.
delete what was in the new table then did an import into the new database.

Mittineague explanation does make sense!

it seems like I have to send an e-mail to all users asking them to reset their password.
there is no solution for this

I wouldn’t say there is no solution. (I like to think just about anything can be done given enough time and effort)
But I would say there is no easy solution.

For example, when SitePoint migrated from vBulletin to Discourse the passwords were not imported and needed to be reset.

I didn’t do that. I simply exported the passport field as it was in the database. So I had in my CSV file “j7hu9f5gnj”

Of course, if there’s a translation problem as @mittineague suggests, which you may very well have, there’s no easy solution.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.