(由于备份数据的用户,没有权限create table和create database,已经insert权限,这边需要root用户来操作) 二)备份单个库 [root@blog ~]# mysqldump -S /tmp/mysql.sock -u backdata -p -B louisblog > /opt/mysql_backup/louisblog_$(date +%F_%H).sql Enter password: [root@blog ~]# mysqldump -S /t...
接下来是CREATE DATABASE语句,后跟USE DATABASE命令。 接下来是DROP TABLE IF EXISTS语句,后跟CREATE TABLE;然后我们有插入数据的实际INSERT语句。 由于数据存储为SQL语句,因此称为逻辑备份。在还原转储时,DROP TABLE语句将在创建表之前擦除所有表。 2 按照时间点恢复 要获得时间点恢复,您应指定–single-transaction和...
Interpret all name arguments as database names(将选项后的所有名称参数解释为数据库名称,以空格隔开) 注意:如果dump时不加 --databases 参数而直接跟数据库名,则备份的sql文件中不会打印 "CREATE DATABASE ..." 语句和 "USE `db_name`;" 语句。 --debug Write debugging log --debug-check Print debuggin...
“--no-create-db”:不写入“CREATE DATABASE”语句。 “--no-create-info”:不写入“CREATE DATABASE”语句。 “--no-data”:创建数据库和表的结构,但是不包含数据。 “--no-tablespaces”:不写入“CREATE LOGFILE GROUP”或“CREATE TABLESPACE”。 “--quick”:快速从表中查询一条记录,不使用表的缓冲集。
shell>/data/mysql/base/5.7.25/bin/mysqldump-h10.186.60.187-P3307-uroot-p1--master-data=2--single-transaction-A--routines--events--triggers>/tmp/dump.sql--执行备份 testdb_innodb.sbtest1 期间,往 testdb_myisam.sbtest2 表插入一条数据 ...
mysqldump 是MySQL的一个命令行工具,用于逻辑备份。可以将数据库和表的结构,以及表中的数据分别导出成:create database, create table, insert into的sql语句。当然也可以导出 存储过程,触发器,函数,调度事件(events)。不管是程序员,还是DBA都会经常使用的一个工具。
with all databases selected. --add-drop-database Add a 'DROP DATABASE' before each create. --add-drop-table Add a 'drop table' before each create. --add-locks Add locks around insert statements. --allow-keywords Allow creation of column names that are keywords. ...
The--databasesoption causes all names on the command line to be treated as database names. Without this option,mysqldumptreats the first name as a database name and those following as table names. With--all-databasesor--databases,mysqldumpwritesCREATE DATABASEandUSEstatements prior to the dump...
To make the mysqlbackup command create these subdirectories automatically, specify the –with-timestamp option each time you run mysqlbackup.For one-time backup operations, for example when cloning a database to set up a replication slave, you might specify a new directory eac...
mysqldump -uops -p -h127.0.0.1 -P4444 --default-character-set=utf8mb4 --single-transaction --master-data=2 --flush-logs --hex-blob --triggers --routines --events --all-databases > /tmp/backup/all_db_with_data.sql 注意:如果是MySQL5.7版本有BUG(详情请看五、已知BUG)需要多添加一步...