Mysqldump uses scripts backed up by sub-libraries
#! / bin/sh
# Author:Luojq
BAKTIME=$ (date +% Y-%m-%d%H:%M:%S)
USER_PSWD=123456
USER_NAME=root
MYLOGIN= "mysql-u$ {USER_NAME}-p$ {USER_PSWD}"
DUMP_CMD= "/ usr/bin/mysqldump-u ${USER_NAME}-p$ {USER_PSWD}-B-master-data=2-- single_transaction-- flush-logs-- skip-add-drop-table"
DATABASE= "$($MYLOGIN-e" show databases; "| egrep-vi" _ schema | mysql ")"
For dbname in ${DATABASE}
Do
MYDIR=/data/backup/$ {dbname}
[!-d ${MYDIR}] & & mkdir-p ${MYDIR}
$DUMPCMD ${dbname} | gzip > ${MYDIR} / ${dbname} ${BAK_TIME} .sql.gz
Done
Mysql common commands
Show processlist; # looks at the SQL statements that are being executed in the database and may not be able to see the complete SQL statements.
Show full processlist; # view the full SQL statement being executed and show it in its entirety.
Set global key_buffer_size = 1024102432; # adjust the database parameters without restarting the database, which will take effect directly and become invalid after restart.
Show variables; # check the configuration parameters of the database, such as the validity of the parameters in my.cnf.
Kill id command to kill the thread, id is the thread number (under mysql)
Show status views database state information for the current session.
Show global status looks at the running status information of the entire database. It is very important to analyze and monitor.
Show engine innodb status displays the performance status of the innodb engine