Reputation:
I am moving hosting providers and I have about 20 sites that I'm moving and you guessed it, they all have MySQL databases and unique users. Is there an easy way to export all these sites databases and users into a single file or a few files so that I dont have to individually export each one and create a new user, etc. on the new host?
Upvotes: 1
Views: 7961
Reputation: 2282
mysqldump --no-create-info -h hostname --user user -pPa55word mysql >dump.sql
Now edit dump.sql and take out everything you don't want. Alternatively just dump the user table
mysqldump --no-create-info -h hostname --user user -pPa55word mysql user >dump.sql
Then import
mysql -u user -pPa55word mysql < dump.sql
After importing the SQL file you will have to run
FLUSH PRIVILEGES;
on the destination MySQL server, in order for the change to take effect immediately.
Upvotes: 4