用MySQL的shell创建了一个MySQL账号:
CREATE USER 'root'@'%' IDENTIFIED BY 'some-secret-pw'; GRANT ALL ON *.* TO 'root'@'%'; flush privileges;
但是登录的时候报错,如下:
[root@git mysql]# mysql -uroot -h172.17.0.8 -p Enter password: ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
解决办法
修改这个账号的加密方式是:mysql_native_password,就可以顺利登录了,在MySQL的shell下执行代码如下:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'some-secret-pw';
文章评论