mysql ERROR 2003 错误处理

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061) 

现象:

本机mysql已经起来,用Navicat for MySQL也能连接上,但是在命令行(CMD)中,mysql  -u root  -p 密码时报如上错误.(密码是正确的),

操作如下:

1,检查mysql服务是否存在

c:\>sc query mysql

SERVICE_NAME: mysql
  TYPE : 10 WIN32_OWN_PROCESS
  STATE : 4 RUNNING
  (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
  WIN32_EXIT_CODE : 0 (0x0)
  SERVICE_EXIT_CODE : 0 (0x0)
  CHECKPOINT : 0x0
  WAIT_HINT : 0x0

2,检查mysql是否起来

c:\>net start mysql

请求服务已经启动

3,链接数据库>mysql -uroot -p
Enter password: ******
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

解决问题:

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -u root -p
Enter password: ***********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.29-rc-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


原因: 系统变量中没有注册相关路径,所以在c:\>无法链接上,在bin>下就ok了。


参考资料[1]

ERROR 2003: Can't connect to MySQL server on 'localhost' (10061)解决方法

http://www.blogjava.net/bcims/archive/2007/07/03/127939.html









你可能感兴趣的:(mysql,数据库,server,service,cmd,query)