用命令行工具,登录
1、以下命令就可以授权
@‘%‘:远程访问授权 @‘localhost‘本机访问
mysql> grant all privileges on *.* to ‘用户名‘@‘%‘ identified by ‘密码‘
with grant option;
mysql> flush privileges;
mysql> select host, user ,authentication_string from user;
+-----------+---------------+-------------------------------------------+
| host | user | authentication_string |
+-----------+---------------+-------------------------------------------+
| localhost | root | *F639C88D14D6F97EE915C916066C13C7E6127BEA |
mysql5.7以上password改成了authentication_string。
参考:
https://www.cnblogs.com/cnsdhzzl/p/11479808.html