MySQL

From Wildsong
Revision as of 03:24, 6 August 2017 by Brian Wilson (talk | contribs)
Jump to navigationJump to search

Notes on moving MySQL (MariaDB on Debian) into Docker container

Back up databases

cd /green/BACKUPS/bellman_mysql for db in mysql asterisk owncloud yaris; do mysqldump -u root $db > $db.sql; done

Docker

I am using the official mariadb docker, I turned off the database running on the host and did

docker run -d --name db -p 3306:3306 -v /var/lib/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD='SECRET' mariadb:latest

and I can see it worked with

docker exec -it db mysql -u root -p mysql

select * from db;