centos7+安装mysql8
时间: 2023-12-03 12:37:54 浏览: 91
CentOS 7 yum安装MySQL8.docx
安装MySQL 8.0的步骤如下:
1. 下载MySQL 8.0的yum源并安装:
```
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
sudo rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
```
2. 安装MySQL 8.0:
```
sudo yum install mysql-community-server
```
3. 启动MySQL服务:
```
sudo systemctl start mysqld
```
4. 查看MySQL服务状态:
```
sudo systemctl status mysqld
```
5. 设置MySQL开机自启动:
```
sudo systemctl enable mysqld
```
6. 首次启动MySQL服务时,会生成一个临时密码,可以通过以下命令查看:
```
sudo grep 'temporary password' /var/log/mysqld.log
```
7. 登录MySQL并修改密码:
```
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
```
其中,new_password为你要设置的新密码。
阅读全文