这个问题很烦人。看来这个大哥的博客改了,问题和我一模一样。MySQL出现:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)解决问题 - 枫叶少年 - 博客园
怕以后找不到,下面原文复述,希望谅解:
本文mysql安装环境为win7 64位,mysql版本为MySQL5.7
问题描述:输入命令行 mysql -u root -p 登录mysql,返回”Can't connect to MySQL server on localhost (10061)”错误
意思大概是:不能连接到本地主机(10061)MySQL服务器
1、首先安装mysqld输入命令:服务器:mysqld --install
现在安装好了
2、接下来就是启动服务器了,输入命令:net start mysql
本来以为这个地方就像别人一样开始了,结果事与愿违,于是又找了很久,别走神!看下面!
三、输入命令:mysqld --initialize-insecure
再次输入:net start mysql
你说得对,开始成功了。嗯,有些人可能可以正常使用,但我太难过了。
又给了我一个问题:Access denied for user 'root'@'localhost' (using password: YES)
5、 安装时设置密码。为什么不用密码就可以登录?
6.更改密码,输入mysql数据库:use mysql
①update mysql.user set authentication_string=password('123456') where user='root' ;
②(5.7.11以前) > update user set password=password("123456") where user="root";
③(5.7.11 或者以后)> update user set authentication_string=password("123456") where user="root";
我在这里用的是:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; 更改密码刷新:flush privileges;
7.退出并重新登录