wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
rpm -Uvh mysql57-community-release-el7-10.noarch.rpm
yum install -y mysql-community-server
systemctl start mysqld.service
systemctl status mysqld.service
systemctl enable mysqld
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
update mysql.user set authentication_string=password('123456') where user='root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;
exit;
异常
1)vim /etc/my.cnf
skip-grant-tables
service mysqld restart
mysql -u root
update mysql.user set authentication_string=password('root') where user='root';
flush privileges;
exit
2) vim /etc/my.cnf
skip-grant-tables
service mysqld restart
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
解决:vim /usr/lib/systemd/system/mysqld.service
User=root
Group=root
systemctl daemon-reload
解决:vim /etc/my.cnf
user=root
解决:vim /etc/yum.repos.d/mysql-community.repo
gpgcheck=0
|