CentOS 7 YUM部署适用于生产环境的MySQL(5.7.X release版本)

部署

 [root@unicom-centos7-shanghai-area0  ~]#  yum install https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm -y
 [root@unicom-centos7-shanghai-area0  ~]#  yum install -y mysql-server 
 [root@unicom-centos7-shanghai-area0  ~]#  systemctl start mysqld && systemctl enable mysqld 
 [root@unicom-centos7-shanghai-area0  ~]#  cat /var/log/mysqld.log | grep -E "root@localhost" # 数据库初始密码
 [root@unicom-centos7-shanghai-area0  ~]#  mysql -u root -p # 进入mysql终端,键入上一步查看的数据库初始密码 
set global validate_password_policy=0;
set global validate_password_length=1;
set password=password('j3n&55yfPWuO');   # 配置数据库密码,此处生成复杂度较高的随机安全密码
grant all on *.* to root@"%" identified by "j3n&55yfPWuO";  # 授权root用户数据库权限
CREATE USER 'ponfeyzhu'@'%' IDENTIFIED BY 'Q1yBjYiEICiD'; # 新增数据库用户
grant all on *.* to ponfeyzhu@"%" identified by "Q1yBjYiEICiD";  # 对新增的数据库用户进行授权
flush privileges; #刷新数据库

查看版本

 [root@unicom-centos7-shanghai-area0  ~]#  mysql -V
 mysql  Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using  EditLine wrapper
上一篇
下一篇