问题如下:
    
    mysql>mysql -uroot -p
    mysql>insert into mysql.user(Host,User,Password) values("localhost","myname",password("mypassword"));
    mysql>flush privileges ;     
    mysql> Ctrl-C -- exit!    mysql -umyname -pmypassword -h localhost
    mysql> show grants;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    10521064
Current database: *** NONE ***ERROR 1184 (08S01): Aborted connection 10521064 to db: 'unconnected' user: 'myname' host: 'localhost' (init_connect command failed)
    
    大家帮我看看,问题出在哪,是mysql配置问题吗?谢谢~

解决方案 »

  1.   

    create user test@'%' identified by 'password';
    不要直接insert
      

  2.   

    create 我也试过了我的需求是添加一个用户,赋予查询权限(select),允许远程访问。
    mysql>grant select  on *.* to myname@'%' identified by 'mypassword' with grant option;
    mysql>flush privileges ; 
    结果还是不行的。
      

  3.   

    你可以借助phpmyadmin数据库可视化工具来添加和配置远程访问,记录一下创建SQL脚本,给大家共享一下,嘿嘿 !
      

  4.   

    mysql>grant  all privilegess  on *.* to myname@'%' identified by 'mypassword' with grant option;
    mysql>flush privileges ; 赋予所有的权限(上面的sql),是可行的,我的疑问是只赋予查询的远程权限怎么弄?
      

  5.   

    上面的sql样式没出来,重贴下mysql>grant  all privileges  on *.* to myname@'%' identified by 'mypassword' with grant option;
    mysql>flush privileges ;
      

  6.   


    还是不行是什么意思,用户创建不成功还是怎么,执行后select user,host from mysql.user查看下结果
      

  7.   

    1、create 和insert本质没区别的,两都能可以在mysql.user表中创建用户记录2、问题是赋予 all privileges 该帐号一切功能都ok,只赋予查询权限  select 该帐号不能正常使用,错误提示为1楼上面的描述。
      

  8.   

    好奇怪的问题建议turncate table mysql.user 
    然后用grant语句试试
      

  9.   

    我记得使用phpmyadmin创建远程访问登陆用户,需要创建两次,一次是创建本地(loacl),一次是创建任意(%),账号和密码都一样,分配权限 和刷新权限,生效 !
      

  10.   

    http://blog.sina.com.cn/s/blog_4d2ae30401007zfq.html