简体   繁体   中英

Restoring MYSQL User Accounts to new Database

I am currently trying to combine two MYSQL Database installations into a single installation. I have already used a batch script to export each individual database to SQL files so they can be imported into the MYSQL that is being kept.

The problem is each individual database has a unique user assigned to it which also needs to be brought over. When doing this in the past, I imported the "mysql" database along with the result, and this caused corruption.

What is the best way to export ONLY the users from the "mysql" database and import them into aa different MySQL instance?

Use the --no-create-info option to mysqldump to keep it from dropping the old table on the target server.

If you have any overlap in the usernames on the two installations, use the --ignore option so that they will be ignored when merging.

So the command is:

mysqldump --no-create-info --ignore mysql user > user.sql

IF you are USING SQL yog then,

go to the TABLE which you need to export to other host/database
right click on the TABLE 
SELECT copy TABLE TO different HOST/Database

Hope it is helpful

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM