无法启动 MySQL 服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20166952/
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
Unable to start MySQL server
提问by The_Unobsequious
Running Windows 7 64-bit.
运行 Windows 7 64 位。
I've been unable to start an instance of MySQL 5.6 server. When I attempt to start it from within the MySQL workbench, I get this:
我一直无法启动 MySQL 5.6 服务器的实例。当我尝试从 MySQL 工作台中启动它时,我得到以下信息:
2013-11-23 14:05:07 - Checking service status of instance MySQL...
2013-11-23 14:05:07 - Status check of service 'MySQL' returned stopped
2013-11-23 14:05:07 - 检查 MySQL 实例的服务状态......
2013-11-23 14:05:07 - 服务“MySQL”的状态检查返回停止
I've tried manually starting the Windows service. Following advice that worked for others with the same problem, I've configured the service to log on as "Local System account". No dice; it throws this:
我试过手动启动 Windows 服务。按照适用于其他有相同问题的建议,我已将该服务配置为以“本地系统帐户”身份登录。没有骰子; 它抛出这个:
error 1053: the service did not respond to the start or control request in a timely fashion
错误 1053:服务没有及时响应启动或控制请求
I've also tried disabling my firewall, and completely reinstalling MySQL server.
我还尝试禁用防火墙,并完全重新安装 MySQL 服务器。
It should perhaps be noted that (I assume as a result of all this) I also cannot log into the MySQL command line client. It tells me:
也许应该注意的是(我认为这是所有这些的结果)我也无法登录到 MySQL 命令行客户端。它告诉我:
Can't connect to MySQL server on 'localhost' (10061)
无法连接到“本地主机”上的 MySQL 服务器 (10061)
This is my first time trying to set up a MySQL server, so perhaps there's just something I've missed. If so, I'm unsure what it is.
这是我第一次尝试设置 MySQL 服务器,所以也许我错过了一些东西。如果是这样,我不确定它是什么。
回答by Besan Vadim
I had the same issue. Try this, it should work!
我遇到过同样的问题。试试这个,它应该有效!
Right click on MySQL Notifier-> Actions-> Manage Monitored Items
Highlight the MySQL56entry and click the deletebutton
- Click the addbutton -> windows service
- Scroll down and look for MySQL56
- Highlightit and click ok
右键单击MySQL Notifier-> Actions-> Manage Monitored Items
突出显示MySQL56条目并单击删除按钮
- 点击添加按钮-> windows服务
- 向下滚动并查找MySQL56
- 突出显示它并单击确定
回答by Aakash Goyal
Try manually start the service from Windows services, Start -> cmd.exe -> services.msc. Also try to configure the MySQL server to run on another port and try starting it again. Change the my.ini file to change the port number.
尝试从 Windows 服务手动启动服务,开始 -> cmd.exe -> services.msc。还尝试将 MySQL 服务器配置为在另一个端口上运行,然后再次尝试启动它。更改 my.ini 文件以更改端口号。
回答by Matt
You should start by checking the error log and/or the startup message log when managing the instance using MySQL Workbench. There could be clues as to what is going wrong, which may be different than this scenario.
在使用 MySQL Workbench 管理实例时,您应该首先检查错误日志和/或启动消息日志。可能有关于出了什么问题的线索,这可能与这种情况不同。
When I had this issue, it was because I used a space in the service name during installation. While it is technically valid, you should not do that. It seems that the MySQL Installer (and MySQL Notifier) does not put the name in quotes which causes it to use an incorrect service name later on. There are two ways to fix the problem (all commands should be run from an elevated command prompt).
当我遇到这个问题时,是因为我在安装过程中在服务名称中使用了一个空格。虽然它在技术上是有效的,但你不应该这样做。似乎 MySQL 安装程序(和 MySQL 通知程序)没有将名称放在引号中,这会导致它稍后使用不正确的服务名称。有两种方法可以解决这个问题(所有命令都应该从提升的命令提示符运行)。
Reinstall the server
重新安装服务器
The first is to simply reinstall MySQL Server 5.6 using the default, no-space service name MySQL56.
第一种方法是使用默认的无空格服务名称简单地重新安装 MySQL Server 5.6 MySQL56。
The installer uses the same value for the service name and service display name. The name that I had originally specified was for a display name, when it should have been a simple service name. After installation, if you so choose, the display name can safely be changed to use spaces and other characters by using:
安装程序对服务名称和服务显示名称使用相同的值。我最初指定的名称是用于显示名称,而它本应是一个简单的服务名称。安装后,如果您选择,可以使用以下命令安全地将显示名称更改为使用空格和其他字符:
sc config MySQL56 DisplayName= "MySQL 5.6"
Recreate the service
重新创建服务
If you don't want to reinstall the server however, you will have to recreate the service. Start by removing the old service:
但是,如果您不想重新安装服务器,则必须重新创建该服务。首先删除旧服务:
mysqld --remove "service_name"
Now install the replacement. You can use --installto create a service that starts with the system automatically, or --install-manualto create a service that requires you to start it.
现在安装替换。您可以使用--install创建一个随系统自动启动的服务,或者--install-manual创建一个需要您启动它的服务。
mysqld --install-manual "service_name" --local-service --defaults-file="C:\path\to\mysql\my.ini"
This creates a service that runs as the LocalServiceaccount which presents anonymous credentials on the network however. Under most circumstances this is fine, but if you want to use the NetworkServiceaccount (which is what the installer creates the service as) you can change it using the Services administrative tool.
这将创建一个作为LocalService帐户运行的服务,该帐户在网络上提供匿名凭据。在大多数情况下,这很好,但如果您想使用NetworkService帐户(安装程序创建该服务的目的),您可以使用服务管理工具更改它。
回答by Venkat
Keep dump/backup of all databases.This is not 100% reliable process. Manual backup: Go to datadir path (see in my.ini file) and copy all databases.sql files from data folder
保留所有数据库的转储/备份。这不是 100% 可靠的过程。手动备份:转到 datadir 路径(参见 my.ini 文件)并从数据文件夹复制所有 databases.sql 文件
This error will be thrown when unexpectedly MySql service is stopped or disabled and not able to restart in the Services.
当意外停止或禁用 MySql 服务并且无法在服务中重新启动时,将抛出此错误。
First try restart PC and MySql Service couple of times ,if still getting same error then follow the steps.
首先尝试重新启动 PC 和 MySql 服务几次,如果仍然出现相同的错误,请按照步骤操作。
Keep open the following wizards and folders:
保持打开以下向导和文件夹:
C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin
C:\Program Files (x86)\MySQL\MySQL Server 5.5
C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin
C:\Program Files (x86)\MySQL\MySQL Server 5.5
Services list ->select MySql Service.
服务列表 -> 选择 MySql 服务。
- Go to installed folder MySql, double-click on instance config C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin\MySqlInstanceConfig.exe
- 转到已安装文件夹 MySql,双击实例配置 C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin\MySqlInstanceConfig.exe
Then select remove instance and click on next to remove non-working MySql service instance. See in the Service list (refresh F5) where MySql service should not be found.
然后选择删除实例并单击下一步以删除非工作的 MySql 服务实例。请参阅服务列表(刷新 F5)中不应找到 MySql 服务的位置。
- Now go to C:\Program Files (x86)\MySQL\MySQL Server 5.5 open my.ini file check below
- 现在去 C:\Program Files (x86)\MySQL\MySQL Server 5.5 打开 my.ini 文件检查下面
#Path to installation directory
#Path to installation directory
basedir="C:/Program Files (x86)/MySQL/MySQL Server 5.5/"
basedir="C:/Program Files (x86)/MySQL/MySQL Server 5.5/"
#Path to data directory
#Path to data directory
datadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/"
datadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/"
Choose data dir Go to "C:/ProgramData/MySQL/MySQL Server 5.5/Data/" It contains all tables data and log info, ib data, user.err,user.pid . Delete
- log files,
- ib data,
- user.err,
- user.pid files.
选择数据目录 转到“C:/ProgramData/MySQL/MySQL Server 5.5/Data/” 包含所有表数据和日志信息,ib数据,user.err,user.pid。删除
- 日志文件,
- ib数据,
- 用户错误,
- user.pid 文件。
(why because to create new MySql instance or when reconfiguring MySql service by clicking on MySqlInstanceConfig.exe and selecting default configure, after enter choosing password and clicking on execute the wizard will try to create these log files or will try to append the text again to these log files and other files which will make the setup wizard as unresponding and finally end up with configuration not done).
(为什么因为要创建新的 MySql 实例或通过单击 MySqlInstanceConfig.exe 并选择默认配置来重新配置 MySql 服务时,输入选择密码并单击执行后,向导将尝试创建这些日志文件或将尝试再次将文本附加到这些日志文件和其他文件将使安装向导无响应,并最终导致配置未完成)。
- After deleted selected files from C:/ProgramData/MySQL/MySQL Server 5.5/Data/ go to C:\Program Files (x86)\MySQL\MySQL Server 5.5
- 从 C:/ProgramData/MySQL/MySQL Server 5.5/Data/ 删除选定的文件后,转到 C:\Program Files (x86)\MySQL\MySQL Server 5.5
Delete the selected files my.ini and and other .bak format files which cause for the instance config.exe un-responding.
删除选择的文件 my.ini 和其他导致实例 config.exe 无响应的 .bak 格式文件。
- C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin\MySqlInstanceConfig.exe Select MySqlInstanceConfig.exe and double-click on it and select default configuration or do the regular set up that we do when installing MySql server first time.
- C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin\MySqlInstanceConfig.exe 选择 MySqlInstanceConfig.exe 并双击它并选择默认配置或进行我们第一次安装 MySql 服务器时所做的常规设置。
回答by sgirardin
If like me you had installed a MySQL on your server (Windows 2012), and when reinstalling the installer is unable to start the MySQL service. Then you have to completely erase MySQL! I had to do the following steps to be sure :
如果像我一样你在你的服务器上安装了 MySQL (Windows 2012),并且在重新安装安装程序时无法启动 MySQL 服务。那么你必须彻底清除MySQL!我必须执行以下步骤才能确定:
- Uninstall MySQL like any any software through the Control Panel -> Uninstall a Program
- Be sure to erase the MySQL folder where you installed it.
- Here is the trick (at least for me), you have to erase the C:\ProgramData\MySQL directory. Even if's not visible through the User Interface, enter the address in the windows explorer and you will find it! You will lose all the previous databases and users.
- Restart your OS
- When restarted check if the MySQL service is no more present the Windows Services (search for services in windows).
- Be sure no services that use MySQL (application needing access to MySQL) are active
- Resinstall MySQL and the service will be able to install itself again.
- 通过控制面板像任何软件一样卸载 MySQL -> 卸载程序
- 请务必删除安装它的 MySQL 文件夹。
- 这是诀窍(至少对我而言),您必须擦除 C:\ProgramData\MySQL 目录。即使通过用户界面看不到,在 Windows 资源管理器中输入地址,您也会找到它!您将丢失所有以前的数据库和用户。
- 重新启动您的操作系统
- 重新启动时检查 MySQL 服务是否不再存在 Windows 服务(在 Windows 中搜索服务)。
- 确保没有使用 MySQL 的服务(需要访问 MySQL 的应用程序)处于活动状态
- 重新安装 MySQL,该服务将能够再次自行安装。
Got my info from the following blog :http://blogs.iis.net/rickbarber/completely-uninstall-mysql-from-windows
从以下博客获取我的信息:http: //blogs.iis.net/rickbarber/completely-uninstall-mysql-from-windows
回答by Wandile Nxumalo
Mine did not start because the Server did not accept the 'Dedicated MySQL Server' setting in the Configuration.
我的没有启动,因为服务器不接受配置中的“专用 MySQL 服务器”设置。
回答by Fridtjof Koene
See this post https://bugs.mysql.com/bug.php?id=67917Sometimes a temp directory is missing. I had the same error like "InnoDB: Error: unable to create temporary file; errno: 2"
请参阅此帖子https://bugs.mysql.com/bug.php?id=67917有时缺少临时目录。我有同样的错误,如“InnoDB:错误:无法创建临时文件;errno:2”
回答by Poorna
I solved it by open a command prompt as an administrator and point to mysql folder -> bin -> mysql.exe. it works
我通过以管理员身份打开命令提示符并指向 mysql 文件夹 -> bin -> mysql.exe 来解决它。有用
回答by MemeyMcMemeFace
Go to MySQL installer and click Reconfigure (don't change any existing settings). This should start the server and you'll be off.
转到 MySQL 安装程序并单击重新配置(不要更改任何现有设置)。这应该会启动服务器,然后您就可以离开了。
回答by dhaivat joshi
I had faced the same problem a few days ago.
几天前我遇到了同样的问题。
I found the solution.
我找到了解决方案。
- control panel
- open administrative tool
- services
- find mysql80
- start the service
- 控制面板
- 开放管理工具
- 服务
- 找到mysql80
- 启动服务
also, check the username and password.
另外,检查用户名和密码。

