无法启动并连接到 MySQL 服务器

Can't startup and connect to MySQL server

我正在尝试使用 MySQL Workbench 来启动服务器并连接到它,但很长一段时间我都无法做到。在导航器的“启动/关闭”选项卡中,日志显示

2015-07-13 10:05:27 - Workbench will use cmd shell commands to start/stop this instance

2015-07-13 10:05:28 - Starting server...

2015-07-13 10:05:35 - Server start done.

2015-07-13 10:05:36 - Checking server status...

2015-07-13 10:05:36 - Trying to connect to MySQL...

2015-07-13 10:05:36 - Can't connect to MySQL server on '127.0.0.1' (10061) (2003)

2015-07-13 10:05:36 - Assuming server is not running

2015-07-13 10:05:36 - Checking server status...

2015-07-13 10:05:36 - Trying to connect to MySQL...

2015-07-13 10:05:36 - Can't connect to MySQL server on '127.0.0.1' (10061) (2003)

2015-07-13 10:05:36 - Assuming server is not running

任何人都可以帮助我解决这个问题或提供替代方法 运行 服务器并连接到它吗?谢谢

OS: Windows 8.1

您似乎没有 MySql 服务器 运行。您可以通过在命令提示符下执行类似 shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld" 的命令来手动启动它。

如果你想让服务器自动启动,我建议阅读this SO post.

有关在 windows 上使用 MySql 服务器的更多阅读: https://dev.mysql.com/doc/refman/5.0/en/windows-start-command-line.html http://dev.mysql.com/doc/mysql-windows-excerpt/5.6/en/windows-start-service.html

尽管这个 post 已经很老了,但我已经浪费了大约 2 个小时,因此想要 post 这个可以节省别人的时间。

此解决方案使用 window 的 mysql 安装程序,您曾使用它来安装 MySQL.

  1. 启动您的 windows mysql 安装程序。对我来说是 "mysql-installer-community-8.0.20.0"
  2. 然后remove/uninstall SQL 服务器并删除所有配置
  3. 从 "C:\Program Files\MySQL\MySQL Server 8.0."
  4. 中手动删除 SQL 服务器文件夹
  5. 再次启动 mysql 安装程序并再次安装 SQL 服务器
  6. 您现在可以检查 MySqL 服务器是否已启动。

希望对大家有所帮助。

在我的例子中,MySQL 被手动配置为 运行 的服务。要启动它,我从 Windows 10 搜索框中键入“服务”。然后我右击MySQL80服务,点击'Start'。

我在其他地方找到了这个答案,我不记得了(所以它不完全是我的)但它很有用(它启动了 MySQL 服务器)。以 管理员 身份打开 Windows 终端cmd 并输入:

net start MySQL80