Skip to content

MySQL

Commands

Run as a Docker container

docker run --name mysql -p 3306:3306 -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8

Connection

mysql -u username -p password -h hostname

SQL

Getting primary key from table

SHOW KEYS FROM TABLE;

Check the process

SHOW PROCESSLIST;

Check the max_connections

SHOW VARIABLES LIKE 'max_connections';

output:

+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 150   |
+-----------------+-------+

Checking the wait_timeout

SHOW VARIABLES LIKE '%timeout%';

Troubleshooting

MySQL ERROR 1227 (42000) at line 18: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

mysqldump --skip-lock-tables --set-gtid-purged=OFF ......
Back to top