Managing MySQL
MySQL (or MariaDB) can be managed as root from the host operating system without needing to enter the MySQL or MariaDB container.
Accessing MySQL as Root:
To access MySQL as root, simply run the mysql
command. The credentials are stored in /root/.my.cnf
, which will be automatically loaded. The connection will be made over the Unix Domain Socket instead of TCP.
Changing the MySQL Root Password:
Changing the MySQL root password will not cause any disruption as long as you update /root/.my.cnf
with the new password. This is important because the appcd
service uses these credentials to connect to MySQL.
Common Commands:
-
See a full list of running SQL queries:
mysql -e 'show full processlist'
-
Kill a running SQL query:
mysql -e 'kill 1234'
-
Enter the MySQL container directly:
docker exec -it mysql /bin/bash
-
Enter the MariaDB container directly:
docker exec -it mariadb /bin/bash