Q01 How do you migrate MySQL database between two servers
A01 This can be done using an SQL Dump Export/Import.
1. Export MySQL Database to a dump File
|
|
mysqldump -h myserver1.com -u root -p mydb1 > mydb1.sql |
There are variations to dump multiple databases:
|
|
mysqldump -h myserver1.com -u root -p --databases mydb1 mydb2 > dump.sql |
To backup specific tables:
|
|
mysqldump -h myserver1.com -u root -p mydb1 table1 table2 > dump.sql |
To backup data using a custom query:
|
|
mysqldump -h myserver1.com -u root -p mydb1 --where="mycolumn=myvalue" > dump.sql |
To copy only the schema but not the data:
|
|
mysqldump -h myserver1.com -u root -p mydb1 --no-data > dump.sql |
2.…
Read more ›