centos7安装mysql8.0
时间: 2023-09-12 20:12:36 浏览: 64
Centos7安装mysql8.0
以下是CentOS 7上安装MySQL 8.0的步骤:
1. 下载MySQL的yum仓库rpm包:
```
$ wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
```
2. 安装MySQL的yum仓库rpm包:
```
$ sudo rpm -ivh mysql80-community-release-el7-3.noarch.rpm
```
3. 安装MySQL 8.0:
```
$ sudo yum install mysql-community-server
```
4. 启动MySQL服务:
```
$ sudo systemctl start mysqld
```
5. 获取MySQL初始密码:
```
$ sudo grep 'temporary password' /var/log/mysqld.log
```
6. 登录MySQL并修改密码:
```
$ mysql -u root -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
```
7. (可选)设置MySQL开机自启动:
```
$ sudo systemctl enable mysqld
```
现在,您已经成功安装了MySQL 8.0,并且可以使用新密码登录MySQL。
阅读全文