码迷,mamicode.com
首页 > 数据库 > 详细

mysql docker usage

时间:2019-04-07 09:35:22      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:scratch   cto   word   strong   enc   com   director   password   persist   

1. Start a mysql container:

$docker run -p 3306:3306 --name mysql-server-1 -e MYSQL_ROOT_PASSWORD=welcome1 -v /scratch/cdctest/work/data/:/var/lib/mysql -d mysql

note: /scratch/cdctest/work/data/, the directory in docker host, used for data persistence.

2. Initialize mysql database:

$mysql -u root -p

Create a user named with cdctest
mysql> CREATE USER cdctest IDENTIFIED BY ‘MyTest1@‘;
mysql> grant all privileges on *.* to cdctest@"%" with grant option;

mysql> flush privileges;

$mysql -u cdctest -p

 

mysql docker usage

标签:scratch   cto   word   strong   enc   com   director   password   persist   

原文地址:https://www.cnblogs.com/learn-everyday/p/10664046.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!