linux mysql8配置文件_Linux Centos7配置mysql8.0数据库
时间: 2024-02-15 14:26:42 浏览: 89
Linux中MySQL8配置文件
5星 · 资源好评率100%
好的,我可以为您提供关于在Linux Centos7上配置MySQL8.0数据库的步骤。请按照以下步骤操作:
1. 下载MySQL8.0的yum源:
```bash
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
```
2. 安装yum源:
```bash
yum localinstall mysql80-community-release-el7-3.noarch.rpm
```
3. 安装MySQL8.0:
```bash
yum install mysql-community-server
```
4. 启动MySQL服务:
```bash
systemctl start mysqld
```
5. 查看MySQL服务状态:
```bash
systemctl status mysqld
```
6. 修改MySQL密码:
```bash
mysql_secure_installation
```
7. 登录MySQL:
```bash
mysql -u root -p
```
8. 创建新用户:
```sql
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
```
9. 给新用户授权:
```sql
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
```
10. 刷新权限:
```sql
FLUSH PRIVILEGES;
```
11. 修改MySQL配置文件:
```bash
vi /etc/my.cnf
```
在[mysqld]下添加:
```bash
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
```
12. 重启MySQL服务:
```bash
systemctl restart mysqld
```
以上就是在Linux Centos7上配置MySQL8.0数据库的步骤,希望能够帮到您。
阅读全文