日期:2014-05-16  浏览次数:20535 次

mysql创建数据库后出现Access denied for user 'root'@'%' to database ‘xxxx’
 
create database test1;

 
  创建完数据库后,通过远程连接提示

 
Access denied for user 'root'@'%' to database ‘xxxx’



  原因:创建完数据库后,需要进行授权,(在本地访问一般不会存在这个问题)。


  解决办法:

 
  执行授权

    grant all on xxxx.* to 'root'@'%' identified by 'password' with grant option;

    xxxx代表创建的数据库;
    password为用户密码,在此为root的密码



完成后即可!