方法一: 在管理--》服务中启动 Mysql 服务 下面的方式没有试,也记录一下 问题描述:在命令行输入 mysql -u root -p 登录mysql,返回”Can't connect to MySQL Server on l
方法一:
在管理--》服务中启动 Mysql 服务
下面的方式没有试,也记录一下
问题描述:在命令行输入 mysql -u root -p 登录mysql,返回”Can't connect to MySQL Server on localhost (10061)”错误
问题原因:查到问题原因是mysql没有启动。
解决方法:1、将mysql加入到windows的服务中。切换到mysql安装目录下的bin文件夹,命令行运行"mysqld --install"
1 C:\Program Files\MySQL\MySQL Server 5.7\bin> mysqld --install2 Service successfully installed.
此时若使用“net start mysql”成功启动msyql,则无须执行下面步骤
2、初始化mysql数据库,输入“mysqld --initialize --user=root --console”。下面红色文字为初始化后的root 密码,最后一部分是密码: u).ig.Gd.7hW
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --initialize --user=root --console2016-10-29T01:35:44.309833Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2016-10-29T01:35:46.659968Z 0 [Warning] InnoDB: New log files created, LSN=457902016-10-29T01:35:47.154996Z 0 [Warning] InnoDB: Creating foreign key constraintsystem tables.2016-10-29T01:35:47.362008Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generatinga new UUID: 043563f4-9d78-11e6-a8c8-606dc79c383c.2016-10-29T01:35:47.388009Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.2016-10-29T01:35:47.401010Z 1 [Note] A temporary passWord is generated for root@localhost: u).ig.Gd.7hW
3、此时使用“net start mysql”成功启动msyql
4、使用生成的密码登录mysql,通过“set password=password('123456')”修改密码。此处将root密码设置为123456
mysql> set password=password('123456');Query OK, 0 rows affected, 1 warning (0.00 sec)
https://www.cnblogs.com/technologylife/p/6010205.html
来源地址:https://blog.csdn.net/code_snow/article/details/129772637
--结束END--
本文标题: MySQL问题--Can‘t connect to MySQL server on localhost (10061)解决方法
本文链接: https://lsjlt.com/news/391129.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0