Simple reference, moving a mysql database:
mysqldump -h <oldhostip/name> -u username -p[<password>] <databasename> > <dumpfilename>.sql mysql -u<username> -p[<password>] < <dumpfilename>.sql
Note: The lack of spaces in some places of the commands. They are intended.
Note: Specifying the password after -p is []’d, which means it’s optional.
Note: If you do enter a password on the command line, it will get saved in your .bash_history or similar in clear text.
1 Comment
If a database is quite big and downtime is not acceptable (mysqldump locks tables) then you might want to use percona xtrabackup for online hot-migration.