1.下载,进入mysql官网,查找需要的版本;
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.29-1.el7.x86_64.rpm
2.安装mysql包
rpm -ivh mysql-community-server-5.7.29-1.el7.x86_64.rpm
报如下图错误,提示依赖mysql-community-client,mysql-community-common-5.7.29
wget下载这些包,rpm -ivh *.rpm (安装rpm包) #RPM软件包管理器,-i 安装rpm包,-vh显示安装进度;最终发现需要安装这4个;
3.开启mysql服务
systemctl start mysqld.service
查看mysql状态:systemctl status mysqld.service
4.查看mysql临时密码,grep "password" /var/log/mysqld.log;
修改密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssw0rd';
5.上述设置,无法使用navicat for mysql远程连接mysql,需设置host为%,具体步骤如下:
mysql -uroot -pP@ssw0rd
use mysql; #使用mysql数据库
update user set host='%'' where user='root' ;
flush privileges;