In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
What this article shares to you is about how to back up the Windows host regularly in MySQL. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
For Windows host
=
Hypothetical environment:
MySQL installation location: C:MySQL
The database name is: bbs
MySQL root password: 123456
Database backup destination: D:db_backup
Program code
@ echo off
C:MySQLinmysqladmin-u root-- password=123456 shutdown
C:MySQLinmysqldump-- opt-u root-- password=123456 bbs > D:db_backupbs.sql
C:MySQLinmysqld-nt
Save the above code as backup_db.bat
Then use Windows's scheduled tasks to execute the script on a regular basis.
At the same time, you can use PHP to complete:
Make it possible for MYSQL to achieve automatic backup!
1. Edit the following code and save it as backup.,. If you want to compress it, you can copy a rar.exe:
If ($argc! = 2 | | in_array ($argv [1], array (--help, -?)) {
? >
Backup Ver 0.01, for Win95/Win98/WinNT/Win2000/WinXP on i32
Copyright (C) 2000 ptker All rights reserved.
This is free software,and you are welcome to modify and redistribute it
Under the GPL license
PHP Shell script for the backup MySQL database.
Usage:
Can be database name you would like to backup.
With the-help, or? Options, you can get this help and exit.
} else {
$dbname = $argv [1]
$dump_tool = "c:\ mysql\ bin\ mysqldump"
$rar_tool = "d:\ php4\ rar"
@ exec ("$dump_tool-- opt-u user-ppassword $dbname >. / $dbname.sql")
@ exec ("$rar_tool a-ag_yyyy_mm_dd_hh_mm $dbname.rar $dbname.sql")
@ unlink ("$dbname.sql")
Echo "Backup complete!"
}
? >
2. Add a task plan and enter the command at this step (shown in figure 2):
D:php4php.exe-Q D:php4ackup.php databasename
3. Set the time to run once a day, and then run the task.
4. Finally, a rar file with name and current time will be generated in the d:php4 directory.
The above is how to back up the Windows host regularly in MySQL. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.