MySQL: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Created page with "Notes on moving MySQL (MariaDB on Debian) into Docker container Back up databases The important databases today are: mysql asterisk owncloud Docker The official mysql doc..."
 
Brian Wilson (talk | contribs)
mNo edit summary
Line 3: Line 3:
Back up databases
Back up databases


The important databases today are:
cd /green/BACKUPS/bellman_mysql
for db in mysql asterisk owncloud yaris; do mysqldump -u root $db > $db.sql; done


mysql
Docker
asterisk
owncloud


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


The official mysql docker
and I can see it worked with


  docker pull mysql
  docker exec -it db mysql -u root -p mysql
select * from db;

Revision as of 03:24, 6 August 2017

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;