Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use mysqldump better

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following brings you about how mysqldump should be better used. If you are interested, let's take a look at this article. I believe it will be of some help to you after reading how mysqldump should be better used.

'MYISAM':'- v-E-e-R-triggers-F-n-opt-- master-data=2-- hex-blob-B'

'INNODB':'- v-E-e-R-triggers-F-single-transaction-n-opt-master-data=2-hex-blob-B'

Parameter description:

-v:verbose mode, which outputs more information about the program.

-- events,-E: use event Scheduler to complete the backup, but database permissions are required.

-- extended-insert,-e: INSERT is written using a list, that is, multiple values are inserted in a statement, which makes the backup file smaller.

-- routines,-R: includes the dump database output of stored procedures (procedures and functions). This option requires SELECT permission for the mysql.proc table. Using, the output generated by the routine includes the creation procedure and the creation function statement creation routine. However, these statements do not include properties, such as routine creation and modification timestamps, so routines. Reload, creation timestamp equals reload time. If you need to create routines and original timestamp properties, do not use routines. Instead, dump and reload the contents of the mysql. Proc direct table, using the MySQL account has the appropriate MySQL database privileges.

-- triggers: triggers are exported when each table is exported, but TIGGER permission is required, and this option is enabled by default.

-- flush-logs,-F: refresh the logs of MySQL CVM before backup. This option requires RELOAD permission. If you use this option in the-- all-databases scenario, the logs will be refreshed at each database. -- lock-all-tables,-- master-data, or (as of MySQL 5.5.21)-- when single-transaction: the log will only be refreshed once, and table locks will be added during execution. If you want to refresh the log during backup,-- lock-all-tables,-- master-data, or-- single-transaction. Use with this option.

-- no-create-db,-n: when the-- databases or-- all-databases options are given, the CREATE DATABASE instruction is not executed

-- hex-blob: columns containing binary information will be output from hexadecimal (for example, 'abc', will be output to 0x616263, affected data types: BINARY, VARBINARY, the BLOB types, and BIT)

-- database,-B: back up the development database. In general, when mysqld treats name parameters, the first parameter is the database name, followed by the table name. However, when using this option, all name parameters are backed up as database names. CREATE DATABASE and USE directives are added before each database backup.

The-- opt directive is equivalent to-- add-drop-table,-- add-locks,-- create-options,-- disable-keys,-- extended-insert,-- lock-tables,-- quick, a, and-- set-charset. These options are the default, because-- opt is the default option.

Master-data=2 CHANGE MASTER TO is written as a SQL comment

-- the function of the single-transaction parameter to set the isolation level of the transaction to repeatable read, that is, REPEATABLE READ, which ensures that all the same queries in a transaction read the same data, which probably ensures that during the dump period, if the thread of another innodb engine modifies the data of the table and commits it, it will not affect the data of the innodb thread, and the table will not be locked during this period.

Read the details above about how to make better use of mysqldump, and whether you have gained anything. If you want to know more about it, you can continue to follow our industry information section.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report