grant all on test.* to root@'%' identified by 'xxxxxx' with grant option;
flush privileges;
本地用127.0.0.1连接不上
show grants;
grant all on test.* to root@'localhost' identified by 'xxxxxx' with grant option;
flush privileges;
------------------------------------------------------
如果设置了localhost(%与本地是分开设置权限的),还提示没有权限(password yes),原因是localhost的连接用户和密码与%的不同,需要更换成localhost的用户名和密码连接。
-------------------------------------------------------
添加指定权限:grant select on `music_app`.* to `root`@`localhost`;