【docker】使用學習

【docker】使用學習mysql

備份源sql

# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下載163的源,這是centos7的docker

# curl -o CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

其餘的源地址centos

CentOS5 :http://mirrors.163.com/.help/CentOS5-Base-163.repo
CentOS6 :http://mirrors.163.com/.help/CentOS6-Base-163.repo緩存

緩存bash

# yum clean all
# yum makecache

看內核,3.10以上curl

# uname -r 

安裝docker學習

# yum -y install docker

啓動docker加密

# systemctl start docker

開機啓動dockerurl

# systemctl enable docker

 

mysql

docker pull mysql
docker run --name mysqlServer -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql
docker exec -it mysql bash
#登陸mysql
mysql -u root -p
新加密方式 caching_sha2_password
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
就加密方式 mysql_native_password
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
#添加遠程登陸用戶
CREATE USER 'ycx'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'ycx'@'%';
相關文章
相關標籤/搜索