There are many methods on the Internet about automatic backup of Mysql under windows. In fact, there are some disadvantages and problems. Here we summarize the best method for your reference:
Create a new notepad and rename it to: mysql_backup.bat Then right-click and select Edit, paste the following part in and modify and save. For example, if I want to back up the taobao database, the script is as follows:
net stop mysql
xcopy D:mysqldatataobao*.* D:db_backup%date:~0,10% /y
net start mysql
You can modify the above directories such as the D drive and db_backup by yourself. The meaning of the script is to copy the taobao directory to the directory named after the current day in the db_backup directory of the D drive, for example: d:backup2010-05- 23, please note that many people on the Internet have reposted that it is wrong to use %date:~4,10% as the directory of the day.
Then create a new scheduled task, add mysql_backup.bat to it, and set it to run at what time every morning. This part will not be detailed. If you don’t understand, please contact me Q: 154992172, my website Taobao Women’s Clothing Shopping Guide http ://www.taobao-daogou.org This method has been used repeatedly to back up large-capacity mysql databases without any problems.
Another method is to back up the database into a .sql file through mysql's mysqldump. The disadvantage of this method is that it is fine if the database is small, but if the database is slightly larger, such as more than 1G, it will be extremely slow and take up a lot of memory. The speed is definitely slower than copying files, and the database is still inaccessible during backup. It is better to use the method I gave above.
The above method is only effective for those who have server control or vps. The virtual host can only be backed up with phpmyadmin or Empire Backup King.
Thanks to Taobao Women's Clothing Shopping Guide Network for your contribution