centos7安装MySQL8.0
时间: 2023-10-23 08:12:36 浏览: 92
Centos7安装mysql8.0
安装MySQL8.0的步骤如下:
1. 添加MySQL Yum Repository
```
$ sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
```
2. 安装MySQL Server
```
$ 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. 获取初始密码
```
$ sudo grep 'temporary password' /var/log/mysqld.log
```
7. 登录MySQL并修改密码
```
$ mysql -u root -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
```
阅读全文