介绍
CentOS8的镜像中已经包含了MySQL8.0.13的安装包,可以直接通过yum安装
安装后不会出现像CentOS7的加密方式改变的问题
以下安装均使用root账号
安装MySQL
yum install -y mysql-server
CentOS8系统设置
systemctl start mysqld.service
systemctl enable mysqld.service
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload
新建并授权用户
使用命令mysql执行以下SQL:
create user 'haiyang'@'%' identified by 'haiyang';
grant all privileges on *.* to haiyang@'%';
新建数据库和表
create database `database`;
- mysql8默认字符集就是utf8mb4