将 MySQL 服务器作为服务启动 (Win 8)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15993089/
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
Start MySQL Server as a service (Win 8)
提问by Hans Fortmüller
I am trying out MySQL (Windows 8), with the workbench (gui) installed as well.
我正在试用 MySQL (Windows 8),同时安装了工作台 (gui)。
I am still in the installation / configuration process. I would like to create a new database. So, on the workbench's welcome screen, I have selected New Server Instance- Register a new Server instance to manage
.
我还在安装/配置过程中。我想创建一个新的数据库。因此,在工作台的欢迎屏幕上,我选择了New Server Instance- Register a new Server instance to manage
.
In order to do this, I have went through following configuration steps:
为了做到这一点,我经历了以下配置步骤:
Specify
localhost
as server host,Give it the username and password I am using.
指定
localhost
为服务器主机,给它我正在使用的用户名和密码。
It then tests a database connection, and, in the next step, asks me to
然后它测试数据库连接,并在下一步中要求我
Select the Service to manage from the list below. It will also help find the configuration file.
从下面的列表中选择要管理的服务。它还有助于找到配置文件。
However, the list of possible Services is empty and if I click [next], it says
但是,可能的服务列表是空的,如果我单击 [下一步],它会显示
Error: In Order to manage a MySQL Service it must be installed as a Service. The wizard can not find any MySQL Service at the target machine, so the Server instance cannot be started.
错误:为了管理 MySQL 服务,它必须作为服务安装。向导在目标机器上找不到任何 MySQL 服务,因此无法启动 Server 实例。
I think that I have to somehow start the MySQL Service, as it might already been installed when I had installed the whole MySQL Toolset.
我认为我必须以某种方式启动 MySQL 服务,因为在我安装整个 MySQL 工具集时它可能已经安装了。
So: How would I start this MySQL Service under Windows 8?
那么:我将如何在 Windows 8 下启动这个 MySQL 服务?
Some things I've tried:
我尝试过的一些事情:
The Manualsays to try:
该手册说尝试:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
in order to install it as a Service. Yet, nothing happens and I get the following (some verbose [Note]s were removed):
以便将其安装为服务。然而,没有任何反应,我得到以下信息(删除了一些冗长的 [Note]):
2013-04-13 23:44:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is depreca
ted. Please use --explicit_defaults_for_timestamp server option (see documentati
on for more details).
2013-04-13 23:44:22 2592 [Warning] Can't create test file c:\Program Files\MySQL
\MySQL Server 5.6\data\gast.lower-test
2013-04-13 23:44:22 2592 [Warning] Can't create test file c:\Program Files\MySQL
\MySQL Server 5.6\data\gast.lower-test
[...]
2013-04-13 23:44:22 2592 [ERROR] InnoDB: read can't be opened in .\ibdata1 mode
2013-04-13 23:44:22 2592 [ERROR] InnoDB: The system tablespace must be writable!
2013-04-13 23:44:22 2592 [ERROR] Plugin 'InnoDB' init function returned error.
2013-04-13 23:44:22 2592 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGIN
E failed.
2013-04-13 23:44:22 2592 [ERROR] Unknown/unsupported storage engine: InnoDB
2013-04-13 23:44:22 2592 [ERROR] Aborting
2013-04-13 23:44:22 2592 [Note] Binlog end
[...]
2013-04-13 23:44:22 2592 [Note] mysqld: Shutdown complete
To install the server as a service, I've used this command (per the manual).
要将服务器安装为服务,我使用了此命令(根据手册)。
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
Again, "nothing" happens, I get (again, most of the verbose [Note]s are removed):
再次,“没有”发生,我明白了(同样,大部分冗长的 [Note] 被删除):
Install/Remove of the Service Denied!
c:\Program Files\MySQL\MySQL Server 5.6\bin>mysqld -p --install
2013-04-13 23:43:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is depreca
ted. Please use --explicit_defaults_for_timestamp server option (see documentati
on for more details).
2013-04-13 23:43:24 3764 [Warning] Can't create test file c:\Program Files\MySQL
\MySQL Server 5.6\data\gast.lower-test
2013-04-13 23:43:24 3764 [Warning] Can't create test file c:\Program Files\MySQL
\MySQL Server 5.6\data\gast.lower-test
[...]
2013-04-13 23:43:24 3764 [ERROR] InnoDB: read can't be opened in .\ibdata1 mode
2013-04-13 23:43:24 3764 [ERROR] InnoDB: The system tablespace must be writable!
2013-04-13 23:43:24 3764 [ERROR] Plugin 'InnoDB' init function returned error.
2013-04-13 23:43:24 3764 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGIN
E failed.
2013-04-13 23:43:24 3764 [ERROR] mysqld: unknown option '-p'
2013-04-13 23:43:24 3764 [ERROR] Aborting
2013-04-13 23:43:24 3764 [Note] Binlog end
[...]
2013-04-13 23:43:24 3764 [Note] mysqld: Shutdown complete
回答by Lucky
Type cmd in start and right click and Run as administrator,
在开始输入cmd,右键以管理员身份运行,
then paste the below text in your command prompt,
然后将以下文本粘贴到您的命令提示符中,
"C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\mysqld" --install
If you don't run cmd as Administrator, you'll see Install/Remove of service denied.
,
如果你不以管理员身份运行 cmd,你会看到Install/Remove of service denied.
,
So run the elevated command prompt(Start->cmd->Run as Administrator) to see the Service Successfully installed
message.
因此,运行提升的命令提示符(开始-> cmd-> 以管理员身份运行)以查看Service Successfully installed
消息。
Note: This is even if you have logged in as administrator in windows 7/8.
注意:即使您在 Windows 7/8 中以管理员身份登录也是如此。
If u want to uninstall the service do the following, copy paste the following in command prompt(again elevated command prompt) run this,
如果您想卸载该服务,请执行以下操作,将以下内容复制粘贴到命令提示符(再次提升的命令提示符)中,运行此命令,
sc delete MySQL
sc delete MySQL
Here MySQL
in the command is the service name mysql creates by default in Windows PC. Make sure you see the service is installed in the Services List(Task Manager -> Services Tab -> Check the Mysql service Name column).
MySQL
命令中的这里是mysql在Windows PC中默认创建的服务名称。确保您看到服务已安装在服务列表中(任务管理器 -> 服务选项卡 -> 检查 Mysql 服务名称列)。
回答by ritesh
I have the same Problem. I started the Command Prompt in administrator mode and then went to C:> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
and then just Enter. And it works fine.
我也有同样的问题。我在管理员模式下启动命令提示符,然后转到C:> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
然后只是输入。它工作正常。
Second way:While installing the mysql workbench it ask for username and password. By default username is root so if you have set password and still remember it then start MySQL Command Line Client and enter the password and then start the workbench. It will work fine.
第二种方式:在安装 mysql 工作台时,它要求输入用户名和密码。默认用户名是 root,所以如果你设置了密码并且还记得它,那么启动 MySQL 命令行客户端并输入密码,然后启动工作台。它会正常工作。
Hope this may help you.
希望这可以帮助你。
回答by Mike Lischke
Hans, first of all, the MySQL installer should install the new server as service already. There's no need for you to do this manually. Look in your services list if you already see the service there. Did you get an error message in the MySQL Installer when it came to server/service installation?
Hans,首先,MySQL 安装程序应该已经将新服务器安装为服务。您无需手动执行此操作。如果您已经在那里看到服务,请查看您的服务列表。在安装服务器/服务时,您是否在 MySQL 安装程序中收到错误消息?
Another point is that the server cannot start up as you can see in the log output. Something is seriously wrong with the InnoDB storage. Did you change the configuration somehow? Keep in mind that MySQL data must not be written in the application folder, but in the application data path. By default the MySQL Installer should also take care of this.
另一点是服务器无法启动,正如您在日志输出中看到的那样。InnoDB 存储出现严重问题。您是否以某种方式更改了配置?请记住,MySQL 数据一定不能写入应用程序文件夹中,而应写入应用程序数据路径中。默认情况下,MySQL 安装程序也应该处理这个问题。
And finally, if you start MySQL Workbench with no connections/server instances it will scan the services to find existing MySQL servers and auto create connections and instances for them.
最后,如果您在没有连接/服务器实例的情况下启动 MySQL Workbench,它将扫描服务以查找现有的 MySQL 服务器并为它们自动创建连接和实例。
回答by Anton
That's how I install mysqld
:
这就是我安装的方式mysqld
:
"e:\denwer\usr\local\mysql-1-5.5\my.ini" --install "mysqld" --defaults-file="e:\denwer\usr\local\mysql-5.5\my.ini"
Also I ran command prompt as administrator.
我也以管理员身份运行命令提示符。