1、卸载mysql
rpm -qa |grep -i mysql
yum remove mysql-community*
yum remove mysql80-community-release-el7-1.noarch
2、安装mysql
去mysql官网下载noarch.rpm文件,上传到指定目录
执行安装命令
sudo rpm -ivh mysql80-community-release-el7-1.noarch.rpm
sudo yum install mysql-server
3、mysql设置
跳过授权
echo "skip-grant-tables" >> vi /etc/my.cnf
启动mysql服务
service mysqld strat
设置密码
mysql -u root
use mysql;
update user set authentication_string="root!2018LC" where user="root";
或
update mysql.user set authentication_string=password('root!2018LC') where user='root';
flush privileges;
授权远程连接
查看3306端口是否打开
firewall-cmd --query-port=3306/tcp
开放3306 端口
firewall-cmd --add-port=3306/tcp
授权远程连接:
update user set host = '%' where user ='root';