Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm switching from a vps to another one and i need to migrate my mysql server. Is there an easy way to backup/restore ALL databases and users (with permissions) at once?

Many thanks

share|improve this question

closed as off-topic by Amith KK, Seth, BuZZ-dEE, Avinash Raj, Anwar Shah Feb 24 '14 at 13:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – Amith KK, Seth, BuZZ-dEE, Avinash Raj, Anwar Shah
If this question can be reworded to fit the rules in the help center, please edit the question.

Backup all databases with a character set:

mysqldump --all-databases \
          --add-drop-database \
          --add-drop-table \
          --default-character-set=utf8 \
          --user=myuser \
          --password=mypass \
          > youfile.sql

on older mysql use the latin1 character set.

share|improve this answer

nvm, found it.

oldserver$ mysqldump mysql > mysql.sql
newserver$ mysql mysql < mysql.sql
newserver$ mysql 'flush privileges;'


share|improve this answer
with this you backup only the mysql database, but you need to backup all. – user224465 Feb 23 '14 at 19:14

you can backup the sql database with the following command:
mysqldump -u root -p --database [your-database-name] > database_backup.sql

Enter the above without the braces'[]' to backup your MySQL to the database_backup.sql file.

Later you can restore the database with the following command:
mysql -u root -p [your_database_name] < database_backup.sql

share|improve this answer
yeah, but i want backup all schemas and users... – Doc Feb 23 '14 at 16:55
hope this solves your problem:… – santu47 Feb 23 '14 at 17:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.