我发现把网络断掉后mysql就不能访问了。
使用phpmyadmin(http://localhost/phpmyadmin/index.php?)访问,输入用户名和密码后点击登陆,就会出现“#2002 Cannot log in to the MySQL server”错误。
使用命令行登陆,输入用户名和,密码后登陆,就会出现“ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)”错误。
我怎么才能在断网的情况下访问mysql呢。

解决方案 »

  1.   

    执行这个
    grant all on *.* to root@localhost identified by '123';之后再用命令行登陆 mysql -hlocalhost -uroot -p123 
      

  2.   

    我运行grant出现:'grant' 不是内部或外部命令,也不是可运行的程序
    或批处理文件.
    我在E:\Program Files\MySQL\MySQL Server 5.5\bin路径下执行的
      

  3.   

    改成127.0.0.1/phpmyadmin也不行。
    hosts里面127.0.0.1有于localhost对应。
    不过127.0.0.1对应了很多个网址
      

  4.   

    执行grant all on *.* to root@localhost identified by '123';
    之后再用命令行登陆 mysql -hlocalhost -uroot -p123
    还是出现和原来一样的错误
      

  5.   

    有一个名为mysqlid的进程,服务里面的mysql也是启动的。
    你指的用的什么权限是什么意思?
      

  6.   

    你的mysql服务没开启吧。跟断网没有关系。
      

  7.   

    mysql的服务是已启动,自动。
    我只要一联网就好,一断网就出问题,100%的规律。