Possible Duplicate:
How can I copy MySQL users table from one server to another?
I have a MySQL server with appr. 6000 MySQL users inside. I am now setting up a better MySQL server on a different physical server and need to transfer these 6000 MySQL users from old server to the new one. How can I do this?
The important thing is, permissions and passwords shouldn't change.
Dump the mysql.user table (and optionally the mysql.db table) then replace any specific references to the name of the old host with the name of the new host. Import into the new host database and flush the privileges.
That's not hard is it?
Please keep in mind that mysql.user is different between major releases.
This query brings back
desc mysql.user
and you will see 31 columns.There are actually two ways to safely port users from one database to another regardless of the version of MySQL.
OPTION 1 : Use mk-show-grants (Soon to be called pt-show-grants from Percona Toolkit)
This dumps out all the MySQL Grants as SQL statements, which is completely portable to any MySQL 5.x instance.
OPTION 2 : Run these commands (My personal emulation of what mk-show-grants does)
The resulting MySQLUserGrants.sql from either option can simply be executed and the grant tables are properly populated.
You can do what symcbean explain by phpMyAdmin if you want. Go in the export Tab and chose to export the mysql database (with
user
table ANDdb
table if you want to keep permissions).