如何在Windows XP上启动MySQL服务器

发布于 2024-08-06 08:32:20 字数 249 浏览 6 评论 0原文

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

> mysql -u root

都会收到错误

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

如何解决上述问题?我刚刚下载了MySQL并将其解压在E:盘中。我没有做任何其他事情。我必须先建立连接吗?如果是这样,我该怎么做?

Whenever I try to start MySQL by typing

> mysql -u root

I get the error

ERROR 2003(HY000): Can't connect to MySQL server on 'localhost' (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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(19

吾性傲以野 2024-08-13 08:32:20

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

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

  1. 创建一个名为“data”的新文件夹” 在 MYSQL 安装目录中(即与“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 --初始化取决于您是否希望服务器为'root'@'localhost'帐户生成随机初始密码。
  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”按钮即可连接

Here is the ZIP file that I had downloaded: 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:

  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-insecure or mysqld --initialize depending 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 --console You 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
陌若浮生 2024-08-13 08:32:20

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

要从命令行启动 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.

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

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

**注意:**

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

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

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

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

通过 MySQL 官方页面

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

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

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:

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.

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.

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.

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.

Via MySQL Official Page

是你 2024-08-13 08:32:20

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

1) 在 Windows 中打开服务。

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

MYSQL 服务状态ON Windows服务管理器

3)然后查看mysql是否启动。如果显示已启动,则尝试检查mysql是否正常工作。

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

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

1) Open services in Windows.

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

MYSQL SERVICE STATUS ON Windows service manager

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

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

心碎的声音 2024-08-13 08:32:20
  1. 以管理员身份运行命令提示符并cd到MySQL的bin目录

    一般是(C:\Program Files\MySQL\mysql-5.6.36-winx64\bin)
    
  2. 运行命令:mysqld --install。 (此命令将安装MySQL服务,如果服务已安装,则会提示。)

  3. 运行以下命令来启动和停止服务器

    启动:net start mysql

    停止:net stop mysql

  4. 运行mysql命令。 p>

  5. 享受吧!!

  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 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 mysql command.

  5. Enjoy !!

从﹋此江山别 2024-08-13 08:32:20

或许

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

maybe

E:\mysql-5.1.39-win32\bin>mysql -u root -p
吾性傲以野 2024-08-13 08:32:20

键入

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

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

Type

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

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

仙女 2024-08-13 08:32:20

我使用的是 MySQL Server 5.5,因此我丢失了大多数答案在 bin 文件夹中提到的文件夹。我所做的如下:

  1. 打开资源管理器并进入 C:\Program Files\MySQL\MySQL Server 5.5\bin 或 MySQL 安装目录。
  2. 运行可执行应用程序MySQLInstanceConfig并按照下图操作。

这解决了我的问题,我能够毫无错误地访问数据库。

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 bin folder. What I did instead was the following:

  1. Open Explorer and make your way to C:\Program Files\MySQL\MySQL Server 5.5\bin or your MySQL installation directory.
  2. Run the executable application MySQLInstanceConfig and follow the images below.

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

梦里南柯 2024-08-13 08:32:20

启动mysql服务器

通过命令提示符C:> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --console

或者替代方案到达 bin 然后

mysqld --console

它将启动您的服务器。

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

请单击它

,它会显示输入您的密码:

请输入您的密码。

然后您就可以访问它。

Start mysql server by command prompt

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

Or alternative reach up to bin then

mysqld --console

It will start your server.

If you have mysql command line client available

click on it

it show enter your password :

Please enter your password.

Then you can access it.

红尘作伴 2024-08-13 08:32:20

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

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

听你说爱我 2024-08-13 08:32:20

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

  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”

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

  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"
浪漫之都 2024-08-13 08:32:20

您需要先运行服务器。您使用的命令(在问题中)启动客户端连接到服务器,但服务器不存在,因此出现错误。

由于我不是 Windows 用户(配备了 Linux),所以我可能不是告诉您如何操作的最佳人选,但我可以向您指出 指南 和另一个 指南,向您展示如何在 Windows 中启动并运行 MySQL 服务器。

运行后,您可以使用命令(在问题中)来连接它。

注意:您也可以尝试 http://www.apachefriends.org/en/xampp.html< /a> 如果您计划使用 MySQL 进行 Web 数据库开发。

希望这有帮助。

You need to run the server first. The command you use (in the question) starts a client to connect to the server but the server is not there so there the error.

Since I am not a Windows user (Linux comes equipped) so I might not be the best person to tell you how but I can point to you to a guide and another guide that show you how to get MySQL server up and running in Windows.

After you get that running, you can use the command (in the question) to connect it.

NOTE: You may also try http://www.apachefriends.org/en/xampp.html if you plan to use MySQL for web database development.

Hope this helps.

云之铃。 2024-08-13 08:32:20

该错误抱怨的是 localhost 而不是权限,并且 MySQL 中当前的做法是使用指定 localhost绑定地址 > 在配置文件中。

所以我不认为这是一个密码问题——除了你说你“解压”了MySQL。

安装够了吗?你下载了什么?

是否有任何安装步骤允许您定义 root 密码?

而且,正如 NawaMan 所说,服务器正在运行吗?

The error complains about localhost rather than permissions and the current practice in MySQL is to have a bind-address specifying localhost only in a configuration file.

So I don't think it's a password problem - except that you say you 'unzipped' MySQL.

Is that enough installation? What did you download?

Was there any installation step which allowed you to define a root password?

And, as NawaMan said, is the server running?

你的笑 2024-08-13 08:32:20

你需要做的第一件事是启动 mysql
为此你可以使用
E:\mysql-5.1.39-win32\bin>net start mysql (仅当有 mysql 作为服务运行时)
然后你可以执行
E:\mysql-5.1.39-win32\bin>mysql -u root

first thing you need to do is to start the mysql
for that you can use
E:\mysql-5.1.39-win32\bin>net start mysql (only when there a mysql running as service)
then you can execute
E:\mysql-5.1.39-win32\bin>mysql -u root

猫弦 2024-08-13 08:32:20
  • 以管理员身份运行命令提示符。#

我们可以使用以下命令从 Windows 命令行启动 MySQL 服务。

  • net start mysql

停止MySql服务的命令:

  • net stop mysql

禁用MySql服务:

  • sc config mysql start=disabled

开启MySql服务的命令(系统启动时自动启动MySQL服务):

  • sc config mysql start= auto

设置启动类型为手动的命令:

  • sc config mysql start=manual

如何重启MySql服务?
没有直接命令来重新启动服务。您可以组合停止和启动命令,如下所示。

  • net stop mysql &网络启动mysql
  • Run your command prompt as administrator.#

We can start MySQL service from windows command line using the below command.

  • net start mysql

Command to stop MySql service:

  • net stop mysql

Disable MySql service:

  • sc config mysql start= disabled

Command to enable MySql service(to automatically start MySQL service when the system starts up):

  • sc config mysql start= auto

Command to set the startup type to manual:

  • sc config mysql start= manual

How to restart MySql service?
There is no direct command to restart a service. You can combine stop and start commands like below.

  • net stop mysql & net start mysql
你对谁都笑 2024-08-13 08:32:20

这可能会对你有帮助
我在启动 MySql 服务器时也遇到问题,但按照图片中右侧标记运行命令。它工作正常。

probably this will help you
I was also having problem with starting MySql server but run command as mention right mark in picture . Its working fine .

凉世弥音 2024-08-13 08:32:20
mysql -u root -p

在终端中输入此命令后,它会要求输入密码
输入密码即可开始!

mysql -u root -p

After entering this command in terminal, it will ask for password
Enter the password and you are ready to go!

雨落□心尘 2024-08-13 08:32:20

有一个最好的解决方案可以解决这个问题,并且 100% 有效。
我们知道服务器是一个进程,因此请将其视为进程,转到任务管理器
在Windows中并在任务管理器中查看服务,在该服务中查看MysqlMS80并尝试启动它手动单击它并说运行然后将需要一些时间。

转到您的 mysql 工作台并单击启动/关闭,然后尝试在服务器状态选项中刷新服务器状态。它会加载就是这样。

there is one of the best solution do resolve this problem and it is going to work 100%.
as we know that server is a process so treat it like a process go to the task manager
in windows and see for services in task manager in that service see for Mysql and MS80 and try to start it manually by click on it and say run then will take some time.

go to your mysql workbench and click on start/shutdown then try to refresh the server status in server status option. it will load up thats it.

话少心凉 2024-08-13 08:32:20

1.以管理员身份打开命令提示符。

2.进入程序文件中MySQL安装的bin目录。

3.从Windows资源管理器复制bin目录的位置。

4.在命令提示符下键入 cd 并(粘贴位置)并输入。

5.键入 mysqld --initialize

6.从 Windows 菜单中打开服务并按名称对列表进行排序。

7.右键单击Mysql,然后单击启动。

1.Open a command prompt as Administrator.

2.Go to MySQL installed bin directory in program files.

3.Copy the location of the bin directory from windows explorer.

4.In command prompt type cd and (paste the location) and do enter.

5.Type mysqld --initialize

6.Open services from the windows menu and sort the list by name.

7.Right-click Mysql and click start.

三生池水覆流年 2024-08-13 08:32:20

在 bin 文件夹路径中使用命令“mysql -u root -p”。
并提供您之前设置的 MY SQL 密码。

use the command "mysql -u root -p" in the bin folder path.
and give the MY SQL password which you have set earlier.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文