下载官方仓库
[root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
下载后安装到本地
[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
安装mysql server
[root@localhost ~]# yum -y install mysql-community-server
启动mysql服务
systemctl start mysqld.service
查看mysql服务
systemctl status mysqld.service
如果看到active running则代表成功了,如下图所示

安装成功后还需要修改root账户密码
[root@localhost ~]# grep "password" /var/log/mysqld.log

使用提示的密码登陆mysql,上图所示密码是: (Q&cZgQM,1BG
[root@localhost ~]# mysql -uroot -p
修改密码
mysql> alter user 'root'@'localhost' identified by 'Aa123456$'
注意此时密码必须要大小写字母数字和特殊符号,不然不能配置成功。也无法修改密码策略

开启mysql远程访问
mysql> grant all privileges on *.* to 'root'@'%' identified by 'Aa123456$' with grant option;
最后刷新权限缓存
mysql> flush privileges;
网友评论