Centos7安装mysql8.0

rpm -qa|grep mysql
# rpm -ev [需要移除组件的名称]
或者
# rpm -e --nodeps [需要移除组件的名称] //此命令为强制卸载
wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
yum install mysql-server
systemctl list-unit-files|grep mysqld
systemctl enable mysqld.service
查看是否启动MySQL服务
# ps -ef|grep mysql

启动服务
# systemctl start mysqld.service
chown -R mysql /var/lib/mysql
mysqld --initialize
grep 'temporary password' /var/log/mysqld.log
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
alter user 'root'@'localhost' identified by '12345678';
create user 'yuanweile'@'%' identified with mysql_native_password by '@@@000TrojanYWL000@@@';
grant select,update on trojanywl.* to 'yuanweile'@'%';

//ALL PRIVILEGES
//SELECT, INSERT, UPDATE, DELETE
SHOW GRANTS FOR 'yuanweile'@'%';
set global validate_password.policy=0;
use mysql;
#修改root账户权限
update user set host = '%' where host = 'root';
#刷新权限
flush privileges;