Some of MySQL's notes

Source: Internet
Author: User

--single-transaction mysqldump, don't lock the table

–NO-DATA Backup Structure only


Back up a MySQL database (some) table

Mysqldump-hhostname-uusername-ppassword databasename specific_table1 specific_table2 > Backupfile.sql


Mysql>use Database

Then use the source command, followed by the script file (for example, the. SQL used here)
Mysql>source D:/wcnc_db.sql



Back up all databases on the server

Mysqldump–all-databases > Allbackupfile.sql


#导出某个数据库-structure + data

Shell>mysqldump-h192.168.161.124-uroot-pxxxxxx--opt db_name |gzip-9 >/db_bakup/db_name.gz

#导出某个数据库的表-structure + data + functions + stored procedures

Shell>mysqldump-h192.168.161.124-uroot-pxxxxxx--opt-r db_name |gzip-9 >/db_backup/db_name.gz


# Export the structure of a table for a database

Shell>mysqldump-h192.168.161.124-uroot-pxxxxxx--opt--no-data db_name tal_name | gzip-9 >/db_bak/db_name.tal_name.struct.gz

#导出某个数据库的某张表的数据

Shell>mysqldump-h192.168.161.124-uroot-pxxxxxx--opt--no-create-info db_name tbl_name | gzip-9 >/db_bak/db_name.tbl_name.data.gz

##--opt==--add-drop-table +--add-locks +--create-options +--disables-keys +--extended-insert +--lock-tables +--quick +--set+charset

# #默认使用--opt,--skip-opt Disable--opt parameter


Some of MySQL's notes

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.