如何在 windows xp 上启动 MySQL 服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1509148/
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 14:12:51  来源:igfitidea点击:

How to start MySQL server on windows xp

mysqlwindows-xpmysql-error-2003

提问by Dusk

Whenever I try to start MySQL by typing

每当我尝试通过键入来启动 MySQL 时

> mysql -u root

I get the error

我收到错误

ERROR 2003(HY000): Can't connect to MySQL server on 'localhost' (10061)

错误 2003(HY000):无法连接到“本地主机”上的 MySQL 服务器 (10061)

How can I solve the problem above? I just downloaded MySQL and unzipped it in the E: drive. I have not done anything else. Do I have to make a connection first? If so, how can I do that?

我怎样才能解决上面的问题?我刚刚下载了 MySQL 并将其解压缩到 E: 驱动器中。我没有做任何其他事情。我必须先建立连接吗?如果是这样,我该怎么做?

采纳答案by Hardik Thaker

The MySQL server can be started manually from the command line. This can be done on any version of Windows.

MySQL 服务器可以从命令行手动启动。这可以在任何版本的 Windows 上完成。

To start the mysqld server from the command line, you should start a console window (or “DOS window”) and enter this command:

要从命令行启动 mysqld 服务器,您应该启动一个控制台窗口(或“DOS 窗口”)并输入以下命令:

shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld"
The path to mysqld may vary depending on the install location of MySQL on your system.

You can stop the MySQL server by executing this command:

您可以通过执行以下命令来停止 MySQL 服务器:

shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin" -u root shutdown

**Note : **

**笔记 : **

If the MySQL root user account has a password, you need to invoke mysqladmin with the -p option and supply the password when prompted.

如果 MySQL root 用户帐户有密码,则需要使用 -p 选项调用 mysqladmin 并在出现提示时提供密码。

This command invokes the MySQL administrative utility mysqladmin to connect to the server and tell it to shut down. The command connects as the MySQL root user, which is the default administrative account in the MySQL grant system. Note that users in the MySQL grant system are wholly independent from any login users under Windows.

此命令调用 MySQL 管理实用程序 mysqladmin 连接到服务器并告诉它关闭。该命令以 MySQL root 用户身份连接,这是 MySQL 授权系统中的默认管理帐户。请注意,MySQL 授权系统中的用户完全独立于 Windows 下的任何登录用户。

If mysqld doesn't start, check the error log to see whether the server wrote any messages there to indicate the cause of the problem. The error log is located in the C:\Program Files\MySQL\MySQL Server 5.0\data directory. It is the file with a suffix of .err. You can also try to start the server as mysqld --console; in this case, you may get some useful information on the screen that may help solve the problem.

如果 mysqld 没有启动,请检查错误日志以查看服务器是否在那里写了任何消息来指示问题的原因。错误日志位于 C:\Program Files\MySQL\MySQL Server 5.0\data 目录中。它是后缀为 .err 的文件。您也可以尝试以 mysqld --console 的身份启动服务器;在这种情况下,您可能会在屏幕上获得一些有助于解决问题的有用信息。

The last option is to start mysqld with the --standalone and --debug options. In this case, mysqld writes a log file C:\mysqld.trace that should contain the reason why mysqld doesn't start. See MySQL Internals: Porting to Other Systems.

最后一个选项是使用 --standalone 和 --debug 选项启动 mysqld。在这种情况下,mysqld 会写入一个日志文件 C:\mysqld.trace,其中应包含 mysqld 未启动的原因。请参阅 MySQL 内部:移植到其他系统。

Via MySQL Official Page

通过MySQL 官方页面

回答by George Ninan

Here is the ZIP file that I had downloaded: mysql-5.7.15-winx64.zip

这是我下载的 ZIP 文件:mysql-5.7.15-winx64.zip

Here are the steps to start MYSQL Server (mysql-5.7.15-winx64) for the first time on Windows:

以下是在 Windows 上首次启动 MYSQL Server (mysql-5.7.15-winx64) 的步骤:

  1. Create a new folder named "data" in MYSQL installation directory (i.e. in the same location as where "bin" directory is located. For me it is: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64. This location will vary as per the location where you have extracted the MYSQL zip file)
  2. From here I will use my MYSQL folder location as reference. Go to: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin and execute the command: mysqld --initialize-insecureor mysqld --initializedepending on whether you want the server to generate a random initial password for the 'root'@'localhost' account.
  3. To start the DB, go to: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin and execute mysqld --consoleYou can see the start-up logs being printed.
  4. To connect to DB, go to: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin and execute mysql -u root -p. When prompted, Enter password if it has been set or else just hit "Enter" button to connect
  1. 在MYSQL安装目录下新建一个名为“data”的文件夹(即与“bin”目录所在的位置相同。对我来说是:C:\programs\mysql-5.7.15-winx64\mysql-5.7.15 -winx64。此位置将根据您提取 MYSQL zip 文件的位置而有所不同)
  2. 从这里我将使用我的 MYSQL 文件夹位置作为参考。转到:C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin 并执行命令:mysqld --initialize-insecuremysqld --initialize取决于您是否希望服务器为'root'生成随机初始密码@ “本地主机”帐户。
  3. 启动DB,进入:C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin,执行mysqld --console即可看到打印的启动日志。
  4. 要连接到数据库,请转到:C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin 并执行mysql -u root -p。出现提示时,如果已设置,请输入密码,否则只需点击“Enter”按钮即可连接

回答by x2.

maybe

也许

E:\mysql-5.1.39-win32\bin>mysql -u root -p

回答by Rohan Jain

If the command prompt does not work in Windows, try the following:

如果命令提示符在 Windows 中不起作用,请尝试以下操作:

1) Open services in Windows.

1) 在 Windows 中打开服务。

2) Then check the status for Mysql and if you found status nothing or blank then start the mysql service.

2)然后检查Mysql的状态,如果您发现状态没有或空白,则启动mysql服务。

MYSQL SERVICE STATUS ON Windows service manager

Windows 服务管理器上的 MYSQL 服务状态

3) After then see whether the mysql is start or not .If it shows started then try to check mysql working.

3)然后查看mysql是否启动。如果它显示启动然后尝试检查mysql工作。

It has worked for me when cmd commands were not working.

当 cmd 命令不起作用时,它对我有用。

回答by Chirag Nimavat

  1. Run the command prompt as admin and cd to bin directory of MySQL

    Generally it is (C:\Program Files\MySQL\mysql-5.6.36-winx64\bin)
    
  2. Run command : mysqld --install. (This command will install MySQL services and if already services already installed it will prompt.)
  3. Run below commands to start and stop server

    To start : net start mysql

    To stop : net stop mysql

  4. Run mysqlcommand.

  5. Enjoy !!

  1. 以管理员身份运行命令提示符并 cd 到 MySQL 的 bin 目录

    Generally it is (C:\Program Files\MySQL\mysql-5.6.36-winx64\bin)
    
  2. 运行命令:mysqld --install。(此命令将安装 MySQL 服务,如果已经安装了服务,它将提示。)
  3. 运行以下命令来启动和停止服务器

    开始:net start mysql

    停止:net stop mysql

  4. 运行mysql命令。

  5. 享受 !!

回答by Chris Mathew

Type

类型

C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console

to start the sql server and then test the client connection.

启动sql server,然后测试客户端连接。

回答by Script47

I was using MySQL Server 5.5 as a result I was missing the folder which majority of the answers made mention of in the binfolder. What I did instead was the following:

我使用的是 MySQL Server 5.5,结果我错过了大多数答案在bin文件夹中提到的文件夹。我所做的是以下内容:

  1. Open Explorer and make your way to C:\Program Files\MySQL\MySQL Server 5.5\binor your MySQL installation directory.
  2. Run the executable application MySQLInstanceConfigand follow the images below.
  1. 打开资源管理器并进入C:\Program Files\MySQL\MySQL Server 5.5\binMySQL 安装目录。
  2. 运行可执行应用程序MySQLInstanceConfig并按照下图操作。

This solved my issue and I was able to access the database without any errors.

这解决了我的问题,我能够访问数据库而没有任何错误。

回答by Ashok R

I tried following steps to run mysql server 5.6 on my windows 8.

我尝试按照以下步骤在我的 Windows 8 上运行 mysql server 5.6。

  1. Run command prompt as an administrator
  2. go mysql server 5.6 installation directory (in my case: C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin) copy that location
  3. In Command prompt run "cd C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin"
  4. run "mysql -u root"
  1. 以管理员身份运行命令提示符
  2. 转到 mysql server 5.6 安装目录(在我的情况下:C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin)复制该位置
  3. 在命令提示符下运行“cd C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin”
  4. 运行“mysql -u root”

回答by crunchdog

You also need to configure and start the MySQL server. This will probably help

您还需要配置并启动 MySQL 服务器。这可能会有所帮助

回答by Tushar Patel

Start mysql server by command prompt

通过命令提示符启动mysql服务器

C:> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --console

C:> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --console

Or alternative reach up to bin then

或者替代到达 bin 然后

mysqld --console

mysqld --控制台

It will start your server.

它将启动您的服务器。

If you have mysql command line client available

如果您有可用的 mysql 命令行客户端

click on it

点击它

it show enter your password :

它显示输入您的密码:

Please enter your password.

请输入您的密码。

Then you can access it.

然后就可以访问了。