Centos7.5安装mysql

1. 卸载原有mysql

rpm -qa | grep mysql rpm -e --nodeps mysql*

2. 下载mysql的repo源
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

如果报错:-bash: wget: 未找到命令
安装插件:yum -y install wget
3. 安装mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm

4. 安装MySQL
sudo yum install mysql-server

5. 重置MySQL密码
【Centos7.5安装mysql】先授权/var/lib/mysql访问权限
chown root /var/lib/mysql/ mysql -u root use mysql; update user set password=password('你的密码') where user='root'; exit; service mysqld restart# 重启mysql服务

6. 配置远程访问
mysql -u root -p : 输入上面设置的密码 GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "远程访问密码"; service mysqld restart# 重启mysql服务

7. 关闭防火墙
systemctl stop firewalld.service

    推荐阅读