vim /etc/my.cnf;
>[mysqld]
>port = 3306
>character_set_server = utf8
#启动服务
service mysqld start;
#查询密码
grep 'temporary password' /var/log/mysqld.log;
#修改密码
set password for 'root'@'localhost' = password('YOURPASSWORD');
#本地授权
grant all privileges on *.* to [email protected]"%" identified by 'YOURPASSWORD' with grant option;
#远程授权
grant all privileges on *.* to [email protected] identified by 'YOURPASSWORD' with grant option;
#建库
create database 库名 character set utf8 collate utf8_bin;
#本地授权指定用户
grant all privileges on 库名.* to 用户@localhost identified by 'YOURPASSWORD';
#远程授权指定用户
grant all privileges on 库名.* to 用户@"%" identified by 'YOURPASSWORD' with grant option;
#刷新权限
flush privileges;
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql