Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 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.

3 Answers 3

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;'

from http://serverfault.com/a/36674/145487

share|improve this answer
3  
with this you backup only the mysql database, but you need to backup all. –  user224465 Feb 23 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 at 16:55
    
hope this solves your problem: stackoverflow.com/questions/7848189/… –  santu47 Feb 23 at 17:15

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