在centos 7
上安装mysql 8
的过程记录如下:
1.环境信息
- 服务器版本:CentOS Linux release 7.5.1804 (Core)
2.下载安装文件及必需依赖
下载地址:https://dev.mysql.com/downloads/mysql/8.0.html
。
需要的安装文件
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-community-libs-8.0.25-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-community-client-8.0.25-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-community-server-8.0.25-1.el7.x86_64.rpm
3.执行安装
3.1更新环境信息
sudo yum update
3.2依次执行安装
sudo yum -y install mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm
sudo yum -y install ./mysql-community-libs-8.0.25-1.el7.x86_64.rpm
sudo yum -y install ./mysql-community-client-8.0.25-1.el7.x86_64.rpm
sudo yum -y install ./mysql-community-server-8.0.25-1.el7.x86_64.rpm
3.3安装成功后密码错误
首次登录提示密码错误:
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决办法:在安装过程中已为你生成临时密码,使用下面命令查找临时密码。
sudo grep 'temporary password' /var/log/mysqld.log
3.4配置远程连接
CREATE USER 'root'@'%' IDENTIFIED BY 'enter_your_password_here';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
参考文章: