MySQL 8.3 无法找到.pid 文件

问题描述 投票:0回答:1

我是一个完全的初学者,我尝试从https://dev.mysql.com/downloads/mysql/安装MySQL 8.3的社区版本。

我已经安装了 ZIP Archive 版本,之后我完成了以下步骤:

以管理员身份在CMD中,我发出了以下命令

// Change directory to the MySQL's binary directory
// Suppose that your MySQL is installed in "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
// Initialize the database. Create a root user with random password. Show the messages on console
mysqld --initialize --console
......
...... [Note] A temporary password is generated for root@localhost: xxxxxxxx

启动服务器时我使用了以下命令

-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
-- If Windows Defender Firewall popup, choose "allow access".

然而,上述并没有导致服务器启动,而是返回了以下错误消息

A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-000001 - Can't create/write to file 'C:\myWebProject\mysql\data\2??.pid' (OS errno 2 - No such file or directory)
[ERROR] [MY-010092] [Server] Can't start server: can't create PID file: No such file or directory

运行 mysqld 后的完整控制台也附在下面:

C:\myWebProject\mysql\bin>mysqld --console
[System] [MY-015015] [Server] MySQL Server - start.
[System] [MY-010116] [Server] C:\myWebProject\mysql\bin\mysqld.exe (mysqld 8.3.0) starting as process 13180
[System] [MY-013576] [InnoDB] InnoDB initialization has started.
[System] [MY-013577] [InnoDB] InnoDB initialization has ended.
[Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
[System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
[ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-000001 - Can't create/write to file 'C:\myWebProject\mysql\data\2??.pid' (OS errno 2 - No such file or directory)
[ERROR] [MY-010092] [Server] Can't start server: can't create PID file: No such file or directory
[ERROR] [MY-010119] [Server] Aborting
[System] [MY-010910] [Server] C:\myWebProject\mysql\bin\mysqld.exe: Shutdown complete (mysqld 8.3.0)  MySQL Community Server - GPL.
[System] [MY-015016] [Server] MySQL Server - end.

我尝试在

2??.pid
文件中查找
C:\myWebProject\mysql\data\
文件,但找不到任何此类名称的文件。

非常感谢提供的帮助!

mysql
1个回答
0
投票

配置文件中似乎未正确指定 pid_file 配置指令,因为 mysqld 尝试创建文件 2??.pid,该文件在 Windows 下不是有效的文件名(请参阅 https://learn.microsoft.com /en-us/windows/win32/fileio/naming-a-file,保留字符)。

由于 mysql 8.3 的存档文件没有附带默认的 my.ini,您要么自己创建了该文件,要么当选项文件不存在时 mysqld 使用的默认值在某种程度上无效。 在任何情况下,您只需将以下行添加到 my.ini 中(或在 C:\myWebProject\mysql 中创建文件):

[mysqld]
pid_file = "mysql.pid"

相反,使用安装程序还应该为您提供一个工作配置文件(请参阅https://dev.mysql.com/doc/refman/8.3/en/server-configuration-defaults.html

© www.soinside.com 2019 - 2024. All rights reserved.