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