Docker中安装Mysql

将mysql 复制到docker

docker cp MySQL-server-5.6.36-1.el7.x86_64.rpm mysql_master2:/root/
docker cp MySQL-server-5.6.36-1.el7.x86_64.rpm mysql_master2:/root/
docker cp MySQL-server-5.6.36-1.el7.x86_64.rpm mysql_master2:/root/

安装插件
yum install -y perl perl-Module-Build net-tools autoconf libaio numactl-libs

安装Mysql

rpm -ivh MySQL-server-5.6.36-1.el7.x86_64.rpm
rpm -ivh MySQL-client-5.6.36-1.el7.x86_64.rpm
rpm -ivh MySQL-devel-5.6.36-1.el7.x86_64.rpm

Mysql 安装完毕后查看初始密码
cat ~/.mysql_secret

启动mysql
systemctl start mysql
mysql -uroot -p密码

修改mysql初始密码:
mysql> set password = password('abcd_123')

查询远程登陆授权:

mysql>use mysql;
mysql>select user, password, host from user;

远程登陆授权:

mysql> grant all privileges on *.* to 'root'@'%' identified by 'abcd_123' with grant option;
mysql> flush privileges;

创建新用户

mysql> create user 'repl'@'172.17.0.%' identified by 'abcd_123';
# 其中repl是新用户名,abcd_123是密码,172.17.0.%是可登录serverIP范围
阅读更多
个人分类: mysql/oracle/sqlserver
上一篇Docker 基本命令
下一篇ubuntu16.04 中安装 mysql culster
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭