目录
- 1. 下载安装包
- 2. 解压tar包
- 3. 安装
- 4. 查看安装完成后的安装包
- 5. 初始化mysql
- 6. MySQL设置
1. 下载安装包
- 1.官网地址
- 2.mysql-8.0.35-1.el7.x86_64.rpm-bundle.tar
- 3.放到服务器的目录(这里是/opt/mysql)
2. 解压tar包
- 1.tar -xvf 可以解压tar.xz后缀的压缩文件
- 2.tar -zxvf 可以解压tar.gz后缀的压缩文件
1.进入目录
cd /opt/mysql
2.tar命令解压
sudo tar -xf mysql-8.0.35-1.el7.x86_64.rpm-bundle.tar
3. 安装
sudo rpm -ivh mysql-community-common-8.0.35-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-libs-8.0.35-1.el7.x86_64.rpm
sudo yum remove mariadb-libs
sudo rpm -ivh mysql-community-libs-compat-8.0.35-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-devel-8.0.35-1.el7.x86_64.rpm
- 7.遇到问题mysql-community-devel 安装失败
sudo yum install openssl-devel -y
sudo rpm -ivh mysql-community-client-8.0.35-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-icu-data-files-8.0.35-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-server-8.0.35-1.el7.x86_64.rpm
4. 查看安装完成后的安装包
sudo rpm -qa |grep mysql
- 2.结果示例
5. 初始化mysql
mysqld --initialize --user=mysql
grep "password" /var/log/mysqld.log
6. MySQL设置
service mysqld start
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
FLUSH PRIVILEGES;
exit;
CREATE USER 'root'@'%' IDENTIFIED BY 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
FLUSH PRIVILEGES;
exit;
2059 -Authentication plugin 'caching sha2 password' cannot be loaded:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';