86201746 2019-06-27
系统
CentOS 7.4
安装软件
MySQL8.0.11
wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
yum localinstall mysql80-community-release-el7-1.noarch.rpm
yum clean all yum makecache
groupadd mysql useradd -g mysql mysql
yum install mysql-community-server
systemctl start mysqld
cat /var/log/mysqld.log | grep password
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';
use mysql; update user set host='%' where user='root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
解决:/etc/my.cnf 下[mysqld]后添加 skip-grant-tables
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
解决:刷新权限:flush privileges;
参考文献:CentOS7 安装 mysql8