MySQL's Notes

Source: Internet
Author: User

I've never used a MySQL database, and today I used mysqldump to back up the table structure and record the problems we encountered.

1. Mysqldump default export does not have transactions and stored procedures, if you want to export these can be used with-E and-r[--routines Dump stored routines (functions and procedures)]

2. mysqldump The default export table is with a trigger, do not trigger can be used--skip-triggers

3. The default export is to export data together, no data can be used (-D,--no-data)

    Mysqldump--host=${source_ip}--user=${user}--password=${passwd}        --no-data--databases ${ Database}--table ${table}-r-e >/tmp/${table}.sql

4. Importing data from a local

MySQL--user=${user}--password=${passwd}--host=${mysql_ip}   ${database}--default-character-set=utf8 <<LOCAL'${file}',';

5. Importing data from the target server

MySQL--user=${user}--password=${passwd}--host="172.0.0.1"   ${database}- -default-character-set=utf8 <<eofload DATA  '${file}' , ';
Database and data on the same server

6. mysql Notes

There are 4 types of MySQL notes:

"#": # starts at the end of the line is a comment, can only comment one line
"--" (2 minus a space):--the beginning to the end of the line is a comment, only one line can be commented
"/* XXX * *": Can comment multiple lines, but must be closed, or error
”/*! Numeric code */": can be commented across lines, but must be closed, or error.

Among them, "/*! The number code * * "has a special meaning
For example:/*!40101 SET NAMES GBK */; Represents the code that executes the following set names GBK if the MySQL version is greater than 4.0.1.01.
This has a benefit, so that you can use the unique features of MySQL with this comment, to the non-MySQL database can run normally, do not need to modify,
For MySQL databases, you can take advantage of these features.

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.