Redhat 安装mysql 8.032详细步骤
时间: 2024-05-21 14:08:55 浏览: 220
Redhat安装MySQL 8.0.32的详细步骤如下:
1. 下载MySQL 8.0.32的yum repository文件:
```
$ wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
```
2. 安装yum repository:
```
$ sudo rpm -ivh mysql80-community-release-el7-3.noarch.rpm
```
3. 安装MySQL Server和客户端:
```
$ sudo yum install mysql-community-server mysql-community-client
```
4. 启动MySQL服务:
```
$ sudo systemctl start mysqld
```
5. 查看MySQL服务状态:
```
$ sudo systemctl status mysqld
```
6. 修改MySQL密码:
```
$ sudo grep 'temporary password' /var/log/mysqld.log
```
记录下返回的密码,然后进入MySQL Shell:
```
$ sudo mysql -u root -p
```
在MySQL Shell中输入以下命令修改密码:
```
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
```
7. 配置防火墙,打开3306端口:
```
$ sudo firewall-cmd --add-port=3306/tcp --permanent
$ sudo firewall-cmd --reload
```
现在你可以通过MySQL客户端连接到服务器了。
阅读全文