forked from gregory-vc/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload_db
executable file
·10 lines (9 loc) · 905 Bytes
/
upload_db
1
2
3
4
5
6
7
8
9
10
#!/bin/bash
docker cp host/dump/blog.sql mysql_blog:/blog.sql
docker cp host/dump/blog_auth.sql mysql_auth:/blog_auth.sql
docker exec mysql_auth /bin/bash -c "mysql -u root --password=root --execute='DROP DATABASE IF EXISTS blog'"
docker exec mysql_blog /bin/bash -c "mysql -u root --password=root --execute='DROP DATABASE IF EXISTS blog'"
docker exec mysql_auth /bin/bash -c "mysql -u root --password=root --execute='CREATE DATABASE blog CHARACTER SET utf8 COLLATE utf8_unicode_ci'"
docker exec mysql_blog /bin/bash -c "mysql -u root --password=root --execute='CREATE DATABASE blog CHARACTER SET utf8 COLLATE utf8_unicode_ci'"
docker exec mysql_blog /bin/bash -c "mysql -u root --password=root --default-character-set=utf8 --comments --database=blog < /blog.sql"
docker exec mysql_auth /bin/bash -c "mysql -u root --password=root --default-character-set=utf8 --comments --database=blog < /blog_auth.sql"