MySQL 5.7.20无法设置root密码
MySQL 5.7.20 can't set a root password
全新 mysql 5.7 安装后我的 root 密码出现问题。
我正在尝试从 mysqld_safe --skip-grant-tables &
开始 mysql 然后进入 mysql mysql -u root
并尝试使用
设置密码
root@localhost [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
root@localhost [(none)]> ALTER USER 'root@localhost' IDENTIFIED BY 'password';
我收到这个错误;
ERROR 1396 (HY000): Operation ALTER USER failed for 'root@localhost'@'%'
我也试过这种方法;
root@localhost [mysql]> update user set authentication_string=password('password') where user='root';
Query OK, 0 rows affected, 1 (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 1
两个都不行请帮忙..
试试这个(用户和主机必须用''分开):
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
如果您使用 DML 更改了权限:
update user set authentication_string=password('password') where user='root';
你必须运行:
FLUSH PRIVILEGES;
全新 mysql 5.7 安装后我的 root 密码出现问题。
我正在尝试从 mysqld_safe --skip-grant-tables &
开始 mysql 然后进入 mysql mysql -u root
并尝试使用
设置密码root@localhost [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
root@localhost [(none)]> ALTER USER 'root@localhost' IDENTIFIED BY 'password';
我收到这个错误;
ERROR 1396 (HY000): Operation ALTER USER failed for 'root@localhost'@'%'
我也试过这种方法;
root@localhost [mysql]> update user set authentication_string=password('password') where user='root';
Query OK, 0 rows affected, 1 (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 1
两个都不行请帮忙..
试试这个(用户和主机必须用''分开):
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
如果您使用 DML 更改了权限:
update user set authentication_string=password('password') where user='root';
你必须运行:
FLUSH PRIVILEGES;