MySQL Config
sudo vi /etc/mysql/my.cnf
2. InnoDB
[mysqld] default-storage-engine=innodb innodb_file_per_table=1
3. charset
[mysqld] character-set-server=utf8 #collation-server=utf8_general_ci collation-server=utf8_bin
SHOW FULL COLUMNS FROM table_name;
4. skip_name_resolve
http://serverfault.com/questions/15073/remote-connection-to-mysql-server-takes-very-long
[mysqld]
skip_name_resolve5. Logging
general_log_file = /var/log/mysql/mysql.log general_log = 1
5.1. Slow Query Log
https://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html --2025-04-17
slow_query_log = 1 slow_query_log_file = /var/log/mysql/mysql-slow.log long_query_time = 1 log_queries_not_using_indexes = 1
mysqldumpslow --help
Usage: mysqldumpslow [ OPTS... ] [ LOGS... ]
Parse and summarize the MySQL slow query log. Options are
--verbose verbose
--debug debug
--help write this text to standard output
-v verbose
-d debug
-s ORDER what to sort by (al, at, ar, c, l, r, t), 'at' is default
al: average lock time
ar: average rows sent
at: average query time
c: count
l: lock time
r: rows sent
t: query time
-r reverse the sort order (largest last instead of first)
-t NUM just show the top n queries
-a don't abstract all numbers to N and strings to 'S'
-n NUM abstract numbers with at least n digits within names
-g PATTERN grep: only consider stmts that include this string
-h HOSTNAME hostname of db server for *-slow.log filename (can be wildcard),
default is '*', i.e. match all
-i NAME name of server instance (if using mysql.server startup script)
-l don't subtract lock time from total timemysqldumpslow -s t /var/log/mysql/mysql-slow.log # sort by query time mysqldumpslow -s c /var/log/mysql/mysql-slow.log # sort by count
6. See Also
6.2. Similar Pages
Similar pages by cosine similarity. Words after page name are term frequency.