centos7 安装 mysql5.7, 以及安装中遇到的问题

时间:2022-06-20 21:08:26


# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# rpm -ivh mysql57-community-release-el7-8.noarch.rpm
# yum install mysql-community-server


登录错误:ERROR 1045 (28000): Access denied for user
vi /etc/my.cnf
在[mysqld]下加入
skip-grant-tables
service mysqld restart
mysql -u root -p 不用输入密码直接进入
update mysql.user set authentication_string=password('123456') where user='root';
flush privileges;
quit;
把skip-grant-tables删了
service mysqld restart
mysql -u root -p 输入密码登录

登录以后提示 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决:
set password = password("123456");
修改密码错误: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
只想设置简单密码需要修改两个全局参数:
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;

所有表的所有权限赋值给位于所有IP地址的root用户。
mysql> grant all privileges on *.* to root@'%'identified by 'password';
先新建用户
mysql>create user 'username'@'%' identified by 'password';

centos 开启远程端口
iptables -F