MySQL Workbench 不会连接到本地主机。“数据库服务器实例未知”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17594338/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 18:06:13  来源:igfitidea点击:

MySQL Workbench Will not connect to localhost. "Database server instance is unknown"

mysqlerror-handlinglocalhostmysql-workbench

提问by d code

My MySQL Workbench is not connecting to my local host, and I cannot figure out why exactly it is reacting like this. It just started doing this one day, and randomly it will give me access although it says it is still "unknown", but I am tired of this and would like to fix it.

我的 MySQL Workbench 没有连接到我的本地主机,我无法弄清楚为什么它会做出这样的反应。有一天它刚刚开始这样做,并且随机它会给我访问权限,尽管它说它仍然是“未知的”,但我对此感到厌倦并想修复它。

Since this website reqires that I have a "10" reputation to post images, I will have to describe it.

由于该网站要求我拥有“10”的声誉才能发布图片,因此我必须对其进行描述。

On the Startup/Shutdown tab in the administration page, it says:

在管理页面的启动/关闭选项卡上,它说:

The database server instance is unknown. --The "Start Server" button is faded out so that I cannot click it.

数据库服务器实例未知。--“启动服务器”按钮淡出,无法点击。

Startup Message Log 2013-07-11 08:57:51 - Workbench will use cmd shell commands to start/stop this instance

启动消息日志 2013-07-11 08:57:51 - Workbench 将使用 cmd shell 命令来启动/停止此实例

2013-07-11 08:57:51 - Status check of service 'MySQL' returned error: Not found

2013-07-11 08:57:51 - 服务“MySQL”的状态检查返回错误:未找到

2013-07-11 08:57:51 - Status check of service 'MySQL' returned error: Not found

2013-07-11 08:57:51 - 服务“MySQL”的状态检查返回错误:未找到

2013-07-11 09:00:55 - Status check of service 'MySQL' returned error: Not found

2013-07-11 09:00:55 - 服务“MySQL”的状态检查返回错误:未找到

2013-07-11 09:00:55 - Status check of service 'MySQL' returned error: Not found

2013-07-11 09:00:55 - 服务“MySQL”的状态检查返回错误:未找到

2013-07-11 09:02:01 - Status check of service 'MySQL' returned error: Not found

2013-07-11 09:02:01 - 服务“MySQL”的状态检查返回错误:未找到

Then on the server status tab in the administration page, it says:

然后在管理页面的服务器状态选项卡上,它说:

Name: mysqld@localhost host: localhost server:unknown status: unknown

名称:mysqld@localhost 主机:localhost 服务器:未知 状态:未知

Connection There is no connection to the MySQL server. This functionality requires an established connection to a running MySQL server to work.

连接 没有连接到 MySQL 服务器。此功能需要与正在运行的 MySQL 服务器建立连接才能工作。

If anyone can help out, that would be great!

如果有人能帮忙,那就太好了!

Thanks

谢谢

回答by Ralph Ritoch

I had this problem on my Windows 8.1 machine and it turned out to be problems with the file permissions.

我在我的 Windows 8.1 机器上遇到了这个问题,结果是文件权限问题。

To repair it I went into the folder at "C:\Program Files\MySQL\MySQL Server 5.6" and right clicked on the "data" folder and selected properties. Clicked the security tab and clicked edit. From there click the ADD button then the ADVANCED button and finally the FIND NOW button. In mine I added users, administrators, and "ALL APPLICATION PACKAGES". I granted full control to the users that were already listed for the data folder and the users, administrators, and ALL APPLICATION PACKAGES.

为了修复它,我进入了位于“C:\Program Files\MySQL\MySQL Server 5.6”的文件夹,然后右键单击“data”文件夹并选择了属性。单击安全选项卡并单击编辑。从那里单击 ADD 按钮,然后单击 ADVANCED 按钮,最后单击 FIND NOW 按钮。在我的中,我添加了用户、管理员和“所有应用程序包”。我授予已为数据文件夹列出的用户以及用户、管理员和所有应用程序包的完全控制权。

After the permissions were repaired I opened a command prompt as administrator and changed to the "C:\Program Files\MySQL\MySQL Server 5.6\bin" directory cd "C:\Program Files\MySQL\MySQL Server 5.6\bin". From there you can execute mysqld --installwhich installs the MySQL service.

权限修复后,我以管理员身份打开命令提示符并更改为“C:\Program Files\MySQL\MySQL Server 5.6\bin”目录cd "C:\Program Files\MySQL\MySQL Server 5.6\bin"。从那里你可以执行mysqld --install它安装 MySQL 服务。

More information about installing the mysql service on windows can be found at http://dev.mysql.com/doc/refman/5.0/en/windows-start-service.html

有关在 Windows 上安装 mysql 服务的更多信息,请访问http://dev.mysql.com/doc/refman/5.0/en/windows-start-service.html

[edit] Please note that if you are using a different version of MySQL than the path to the MySQL data directory and bin directory may be different on your windows machine.

[编辑] 请注意,如果您使用的是不同版本的 MySQL,那么 MySQL 数据目录和 bin 目录的路径在您的 Windows 机器上可能会有所不同。

回答by Mike Lischke

The error message says it: the service with the name MySQLcannot be found. So probably your MySQL service has a different name? Do you have a service at all? Starting mysql manually from the bin folder is just that: manual. There is no service involved, hence WB cannot manipulate the run state.

错误消息说:MySQL找不到名称的服务。那么您的 MySQL 服务可能有不同的名称吗?你们有服务吗?从 bin 文件夹手动启动 mysql 就是:手动。不涉及服务,因此 WB 无法操纵运行状态。

When you install MySQL with the MySQL installer you have everything in place within a couple minutes and it works right from the start.

当您使用 MySQL 安装程序安装 MySQL 时,您会在几分钟内完成所有工作,并且它从一开始就可以正常工作。

So first check if you have a service running for your MySQL server and stop starting it manually. If there's a service take its name and enter it in the Windows Service Namefield of the configuration manager:

因此,首先检查您的 MySQL 服务器是否有正在运行的服务,然后停止手动启动它。如果有一个服务,请取其名称并将其输入到配置管理器的Windows 服务名称字段中:

enter image description here

在此处输入图片说明

Note that MySQL Workbench can manage your server only if it is installed as a Windows service.

请注意,只有将 MySQL Workbench 安装为 Windows 服务,它才能管理您的服务器。

回答by cestebanc

I had this problem on my Windows 8.1, and I solved it updating my workbench to Version6 with "mysql-installer-web-community-5.6.16.0.msi" from the official page of mysql

我在 Windows 8.1 上遇到了这个问题,我通过 mysql 官方页面上的“mysql-installer-web-community-5.6.16.0.msi”将我的工作台更新到 Version6 解决了这个问题

回答by Ketan

I have found reinstalling all MySQL products a better alternative, because some of the solutions on the internet will make another instance of your mysql server along with mysql56, which might mess things up for a beginner.

我发现重新安装所有 MySQL 产品是一个更好的选择,因为 Internet 上的一些解决方案会与 mysql56 一起创建另一个 mysql 服务器实例,这可能会给初学者带来麻烦。

Remember to keep database files and configuration undeleted during the reinstallation.

请记住在重新安装期间不要删除数据库文件和配置。