Recently, I bought a new laptop and was challenged to move my development sites over. Copying files and sites is all pretty easy, however, if you do not backup your MySQL server correctly – you will face quite a hassle recreating all the databases and privileges.
I came across the following way that was pretty easy to move around 150 databases with their privileges swiftly.
Please note that the following procedures require command line access and is assuming you are the administrator of the computer.
Open up command line.
Start > Run > Type ‘cmd’ > Enter
Change directory to your MySQL bin folder. This can be C:Program FilesMySQLMySQL 4.1 Serverbin — or C:xamppmysqlbin depending on what your setup is like. You can do so by the ‘cd’ command as follows:
Type in the following command to dump all databases into an sql file.
mysqldump –all-databases > db_backup.sql
This can take several minutes depending on the size of your databases. Once done, check your bin folder for db_backup.sql file which contains SQL queries of your entire MySQL server.
You may want to see my other post regarding restoring MySQL server.