backup restorationMysql-u root-p testdb And then restore the time point based on the bin-log.Mysqlbinlog -- stop-datetime = "21:45:00"/var/lib/mysql/mysql-bin.000022 | mysql-u root-p testdbThen the data is returned.
Of course, this is only a simulated operation. Of course, there are still many details that have not yet been determined. If a log rolling occurs, we need to restore the Log Based on the time point and determine the log file based on the time point.
Summary:
This document only
comment statements from the export file6) –compactUse the--compact option to output only the most important statements, without outputting comments and deleting table statements, etc.Backing up data in SQL formatIf the file name is backed up. SQL does not specify the path to be placed, it is placed by default in the ~\mysql\mysql Server 5.6\bin directory. However, you can specify the path to its backup file in the following ways:mysqldump–h hostname –u User name –p--all-databases > C: \ backup
only the option enabled with-opt, use the -- skip format. For example, -- skip-add-drop-tables or -- skip-quick.
-- Password [= password],-p [password]
The password used to connect to the server. If you use the short option format (-p), there cannot be a space between the option and password. If the password value after the -- password or-p option is ignored in the command line, you will be prompted to enter
-- Port = port_num,-P
Port_num is t
multiple times, one table at a time. Each table must specify both the database and the table name. For example:--ignore-table=database.table1--ignore-table=database.table2 ...Mysqldump-uroot-p--host=localhost--all-databases--ignore-table=mysql.user--include-master-host-portThe ' Change MASTER ' generated in--dump-slave Add ' master_host=Mysqldump-uroot-p--host=l
We will certainly encounter the backup database in the course of running the project, restore the database situation, we generally use two ways to deal with:1. Import and export backup data using into outfile and load data infileThe advantage of this method is that the exported data can be self-defined format, and the export is pure data, there is no table information, you can directly import another database with the different tables, compared to mysqldump
to enter the password of the root user name. after entering the password, the dataname database will be successfully backed up in the mysql/bin/directory.
2. Export a table
Mysqldump-u user name-p database name Table Name> exported file name
Mysqldump-u root-p dataname users> dataname_users. SQL
3. Export a database structure
Mysqldump-u wcnc-p-d-add-dr
-udump_user-pdump_user-B woshittest -- add-drop-table-C> C: \ 1.txt
-- Tables
This is a very useful switch.
Skip the -- databases or-B switch. All names after this switch are considered as table names.
Instance:
C: \> mysqldump-udump_user-pdump_user-B woshittest -- tables pwss -- add-drop-table-c-r> C: \ 1.txt
-R
To export the stored procedure, add the-r switch.
Instance:
C: \> mysqldump-ud
tables from a MySQL Database
The code is as follows
Copy Code
Mysqldump--user=xxxxxxxx--password=xxxxxxxx--databases db_name--tables table_name >/PATH/TO/DUMPFILE. Sql
I ' m using MySQL 4.1.8 on my development server, but am behind a few releases on our production server. In order to make dumps compatible with the old MySQL version, add the following switch:--compatible=mysql323 - ----------------------------
Mysqldump backup and recovery mysql database mysqldump
BitsCN.com
Mysqldump is an effective tool to backup MySQL database. it creates *. SQL file with DROP table, CREATE table and INSERT into SQL-statements of the source database. to restore the database, execute *. SQL file on destination database. for MyISAM, use mysqlhotcopy method that we explained earlier,
indicates that multiple rows can be inserted.
More mysqldump command parameters you can pass the
Copy Code code as follows:
Mysqldump--help
command to view all parameters contained in mysqldump and support for parameters.
Mysqldump Export command instances are as follows
MySQL database after
users> wcnc_users.sql 3. Export a Database structure Mysqldump-u wcnc-p-D--add-drop-table smgp_apps_wcnc >d:wcnc_db.sql-d no data--add-drop-table in each CREATE statement Add a drop table before
Memo: Mysqldump under Linux can be used directly under Windows sometimes need to go into the mysql/bin because sometimes it is similar to Appserv-like package software, so the command cannot be used directly beca
The following articles mainly introduce one of the frequently used backup methods in MySQL Databases: MySQLdump and description of related matters that should be paid attention to during the actual operation of MySQLdump, the following is a description of the specific solution. I hope it will help you in your future study.
MySQLdump
Basic Syntax:
Shell>
tools that can be used to interact with MySQL's database schema, data, users, and configuration variables, while the Mysqladmin tool can perform various administrative tasks, as well as the mysqldump described below. There's a lot more, but that's beyond the scope of this article. Tool mysqldump can be used both to back up the database schema and to back up the data, using it to not only make a blanket bac
--flush-logs--flush-privilegesAfter exporting the MySQL database, issue a flush privileges statement. For proper recovery, this option should be used at any time to export the MySQL database and rely on MySQL database data.Mysqldump-uroot-p--all-databases--flush-privileges--forceIgnores the SQL errors that occur during the export process.Mysqldump-uroot-p--all-databases--force--helpDisplays help information and exits.Mysqldump--help--hex-blobExport binary string fields using hexadecimal format.
end the current log, generate a new log file;The --master-data=2 option will record the name of the new log file after the full backup in output SQL. References for later recovery, such as the output of a backup SQL file, contain:Change MASTER to Master_log_file= ' mysql-bin.000002′, master_log_pos=106; 3.MySQLdump Incremental Backup Additional instructions:If Mysqldump plus –delete-master-logs clears the
MYSQL uses mysqldump to export some data of a table.
BitsCN.com
MYSQL uses mysqldump to export some data of a table
Example:
D:/wamp/mysql/bin> mysqldump-h mysql server IP-u user name-p password database name
-- Where = "filter condition"> Export file path;
MySQLdump is
Mysqldump is an effective tool to backup MySQL database. it creates *. SQL file with DROP table, CREATE table and INSERT into SQL-statements of the source database. to restore the database, execute *. SQL file on destination database. for MyISAM, use mysqlhotcopy method that we explained earlier, as it is faster for MyISAM tables.
Using mysqldump, you can backup a local database and restore it on a remote d
Mysqldump is often used in MySQL database logical backups.
1. Various usage instructions
A. The simplest use:
Mysqldump-uroot-ppassword [database name]
> [dump file]
The above command backs up the specified database to a dump file (dump file), for example:
mysqldump-uroot-p123 Test > Test.dump
user name-P database name Table Name> exported file nameMysqldump-u root-P dataname users> dataname_users. SQL
3. Export a database structureMysqldump-u wcnc-p-D-add-drop-Table smgp_apps_wcnc> D:/wcnc_db. SQL-D no data-add-drop-table add a drop table before each create statement
4. Import the databaseCommon source commandsGo to the MySQL Database Console,For example, MySQL-u root-P
Mysql> Use Database
Then run the source command. The followin
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.