To back up multiple databases, you can use the following command: mysqldump -uroot -p123456 --databases test1 test2 test3 > /home/test/dump.sql; To restore a backup: source dump.sql -- Enter this command in the MySQL command line to restore Back up the entire database: mysqldump -uroot -123456 -A > all.sql Back up the entire database structure: mysqldump -uroot -p123456 -P3306 -A -d > all_002.sql Back up a single database structure and its data mysqldump -uroot -p123456 -P3306 test > all_003.sql Back up a single database structure and its data mysqldump -uroot -p123456 -P3306 test -d > all_004.sql Backing up a single database mysqldump -uroot -p123456 -P3306 test -t > all_005.sql Generally speaking, the structure and data of the backup database are more commonly used in actual production environments. In the era of big data, data is crucial. Through data analysis, certain user behaviors can be discovered, thereby opening up the market. The backup shell script content is as follows: #!/bin/bash base_dir=/home/test/sql_script DATE=$(date +%Y%m%d) time=$(date "+%Y-%m-%d %H:%M:%S") cd $base_dir mysqldump -uroot -p123456 --databases eluzhupms lms > dump$DATE.sql if [ $? -eq 0 ] then echo "Successfully backed up mysql database, current date:"$time >> /home/test/mysql_dump.log else echo "Backup of mysql database failed: Current date is: "$time>> /home/test/mysql_dump.log fi The above is the details of the commonly used MySQL backup commands and shell backup scripts. For more information about MySQL backup, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: JS implements user registration interface function
>>: How to run Linux commands in the background
Multi-way search tree Height of a complete binary...
1. Development environment vue 2. Computer system...
Table of contents FileReader reads local files or...
Preface: I have always wanted to know how a SQL s...
<br />Related article: Analysis of Facebook&...
Preface If the query information comes from multi...
Table of contents introduction Distinguish betwee...
Each web page has an address, identified by a URL...
Many people have read this book: "Grow as a ...
Table of contents Precautions Necessary condition...
Table of contents 1. unzip command 1.1 Syntax 1.2...
1. Background Sysbench is a stress testing tool t...
Table of contents 1. Insert statement 1.1 Insert ...
Preface The computer I use is a Mac, and the oper...
1. About Registry The official Docker hub is a go...