Guest User

Untitled

a guest
Mar 19th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. # run docker from mysql:latest and mount volume explicitly
  2. docker run -d \
  3. --name music-sql \
  4. -p 6033:3306 \
  5. -v /home/vplagov/docker/music-sql/:/var/lib/mysql \
  6. -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
  7. --restart always \
  8. mysql:latest
  9.  
  10.  
  11. # create an empty database
  12. # `<<<` means that part from the right will be passed to exec command as a stdin
  13. docker exec \
  14. -i music-sql \
  15. mysql -u root \
  16. <<< "CREATE DATABASE music;"
  17.  
  18. # load dump file
  19. docker exec \
  20. -i music-sql \
  21. mysql -u root --database=music \
  22. < ~/.mysql-backup/music.sql
Add Comment
Please, Sign In to add comment