This is just a collection of scripts, tutorials, links, articles, commands or any other resource about using docker for MySQL or MariaDB. Because I have to search for it again adn again every time I need it.
WARNING: We are not using a persisted volume. If you remove the volume used by the container you lose the database data.
Run the docker container and connect using the console client:
./bin/start_mysql.sh
./bin/mysql_client.sh
How to run commands using the console client.
Run the client:
mysql -h127.0.0.1 -uroot -pdb-root-password
Run a SQL sentence:
mysql -h127.0.0.1 -uroot -pdb-root-password torrust_v1 < ./your.sql
Run a SQL sentence:
docker exec -i torrust-index-backend-mysql mysql torrust_v1 -uroot -pdb-root-password < ./your.sql
Backup DB:
mysqldump -h127.0.0.1 torrust_v1 -uroot -pdb-root-password > ./schema_dump.sql