centos7安装MySQL8.0
时间: 2023-10-23 19:12:36 浏览: 88
安装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';
```
相关问题
centos7安装mysql8.0
1. 添加MySQL 8.0的yum源
```
wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
yum localinstall mysql80-community-release-el7-1.noarch.rpm
```
2. 安装MySQL 8.0
```
yum install mysql-community-server
```
3. 启动MySQL服务
```
systemctl start mysqld
```
4. 查看MySQL服务状态
```
systemctl status mysqld
```
5. 设置MySQL服务开机自启
```
systemctl enable mysqld
```
6. 获取MySQL默认密码
```
grep 'temporary password' /var/log/mysqld.log
```
7. 登录MySQL
```
mysql -u root -p
```
8. 修改MySQL密码
```
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';
```
9. 修改MySQL配置文件
```
vi /etc/my.cnf
```
在[mysqld]下添加以下内容,设置默认字符集为utf8mb4
```
character-set-server=utf8mb4
default_authentication_plugin=mysql_native_password
```
10. 重启MySQL服务
```
systemctl restart mysqld
```
centos7 安装 Mysql8.0
您好,以下是在 CentOS 7 上安装 MySQL 8.0 的步骤:
1. 添加 MySQL Yum Repository:
```bash
sudo rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
```
2. 安装 MySQL:
```bash
sudo yum install mysql-community-server
```
3. 启动 MySQL 服务:
```bash
sudo systemctl start mysqld
```
4. 设置 MySQL 自启动:
```bash
sudo systemctl enable mysqld
```
5. 查看 MySQL 初始密码:
```bash
sudo grep 'temporary password' /var/log/mysqld.log
```
6. 登录 MySQL:
```bash
mysql -u root -p
```
7. 修改 MySQL 密码:
```sql
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
```
8. 退出 MySQL:
```sql
exit;
```
安装完成后,您就可以使用 MySQL 数据库了。
阅读全文