启动MySQL服务器作为服务(Win 8)

时间:2023-02-08 18:22:06

I am trying out MySQL (Windows 8), with the workbench (gui) installed as well.

我正在试用MySQL (Windows 8),并安装了workbench (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.

我还在安装/配置过程中。我想创建一个新的数据库。因此,在工作台的欢迎屏幕上,我选择了新的服务器实例——注册一个新的服务器实例来管理。

In order to do this, I have went through following configuration steps:

为了做到这一点,我已经完成了以下配置步骤:

  1. Specify localhost as server host,

    指定localhost作为服务器主机,

  2. Give it the username and password I am using.

    给它我正在使用的用户名和密码。

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

但是,可能的服务列表是空的,如果我点击[next],它说。

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服务,因此无法启动服务器实例。

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 Manual says 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):

以将其安装为服务。然而,什么也没有发生,我得到了以下(一些冗长的[注释]被删除):

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):

再次,“没有”发生,我得到(再次,大多数冗长的[注释]被删除):

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

4 个解决方案

#1


23  

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,您将看到被拒绝的服务的安装/删除。

So run the elevated command prompt(Start->cmd->Run as Administrator) to see the Service Successfully installed message.

因此,运行升级的命令提示符(Start->cmd->作为管理员)可以看到服务成功地安装了消息。

启动MySQL服务器作为服务(Win 8)

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删除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服务名称列)。

启动MySQL服务器作为服务(Win 8)

#2


4  

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:\程序文件\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.

希望这对你有帮助。

#3


1  

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?

首先,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工作台,没有连接/服务器实例,它将扫描服务,查找现有的MySQL服务器和自动创建连接和实例。

#4


-1  

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.

我还以管理员的身份运行命令提示符。

#1


23  

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,您将看到被拒绝的服务的安装/删除。

So run the elevated command prompt(Start->cmd->Run as Administrator) to see the Service Successfully installed message.

因此,运行升级的命令提示符(Start->cmd->作为管理员)可以看到服务成功地安装了消息。

启动MySQL服务器作为服务(Win 8)

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删除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服务名称列)。

启动MySQL服务器作为服务(Win 8)

#2


4  

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:\程序文件\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.

希望这对你有帮助。

#3


1  

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?

首先,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工作台,没有连接/服务器实例,它将扫描服务,查找现有的MySQL服务器和自动创建连接和实例。

#4


-1  

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.

我还以管理员的身份运行命令提示符。