yum安装mysql,在学习测试sql语句时方便省事,记录下来吧
安装就几条命令:
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum install mysql-server mysql -y
登录:
grep 'password' /var/log/mysqld.log |head -n1
初始随机密码(mysql5.7及以后版本)
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Bdqn20121120..';
(大写 小写 特殊字符)
如果是免密码登录,则执行下面命令:
update mysql.user set authentication_string=password('Bdqn20121120..') where user='root' and Host ='localhost';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
密码不满足要求
flush privileges;
刷新权限