我无法使用 XAMPP 启动 MySQL,并且没有收到任何错误。因此,如果我单击“开始”,我会收到消息“01:26:41 [mysql] 正在尝试启动 MySQL 服务...”,就是这样。
问题可能是,因为我还安装了MariaDB自带的HeidiSQL。我知道它们都使用相同的端口(3306),并且我尝试将MariaDB的端口更改为3308。
这是my.ini的内容:
[mysqld]
port= 3306
socket = "C:/xampp/mysql/mysql.sock"
basedir = "C:/xampp/mysql"
tmpdir = "C:/xampp/tmp"
datadir = "C:/xampp/mysql/data"
pid_file = "mysql.pid"
# enable-named-pipe
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error = "mysql_error.log"
datadir=C:/Program Files/MariaDB 10.3/data
port=3308
innodb_buffer_pool_size=2033M
character-set-server=utf8
[client]
port=3308
plugin-dir=C:/Program Files/MariaDB 10.3/lib/plugin
mysql_error.log:
2019-07-24 1:18:11 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2019-07-24 1:18:11 0 [Note] InnoDB: Uses event mutexes
2019-07-24 1:18:11 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-07-24 1:18:11 0 [Note] InnoDB: Number of pools: 1
2019-07-24 1:18:11 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-07-24 1:18:11 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2019-07-24 1:18:11 0 [Note] InnoDB: Completed initialization of buffer pool
2019-07-24 1:18:11 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=1791378
2019-07-24 1:18:11 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-07-24 1:18:11 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-07-24 1:18:11 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-07-24 1:18:11 0 [Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-07-24 1:18:11 0 [Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
2019-07-24 1:18:11 0 [Note] InnoDB: Waiting for purge to start
2019-07-24 1:18:11 0 [Note] InnoDB: 10.3.16 started; log sequence number 1791387; transaction id 163
2019-07-24 1:18:11 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
2019-07-24 1:18:11 0 [Note] InnoDB: Buffer pool(s) load completed at 190724 1:18:11
2019-07-24 1:18:11 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-07-24 1:18:11 0 [Note] Server socket created on IP: '::'.
2019-07-24 1:18:11 0 [Note] Reading of all Master_info entries succeeded
2019-07-24 1:18:11 0 [Note] Added new Master_info '' to hash table
2019-07-24 1:18:11 0 [Note] mysql\bin\mysqld.exe: ready for connections.
Version: '10.3.16-MariaDB' socket: '' port: 3307 mariadb.org binary distribution
我已尝试了 that questions 中的所有答案但他们都不适合我。
不仅是XAMPP,我什至无法与HeidiSQL建立连接。错误信息是:
Can't connect to MySQL server on '127.0.0.1' (10061)
我已经卸载了 XAMPP 和 HeidiSQL,然后重新安装了它们。即使这样也没有帮助。任何帮助将不胜感激!
最佳答案
HeidiSQL 只会通过端口 3306 连接到您的 MySQL 实例,但它不会监听任何端口,因此它不会使用您所说的任何端口。
所以你的问题是MySQL服务未启动。
您的 my.ini 看起来好像已经有两个服务正在运行:
- 来自 C:\Program Files\MariaDB 10.3\的一个
- 和一个来自 C:\xampp\mysql\
查看您的服务控制面板,例如从开始菜单运行 services.msc
。然后,留意名为“MySQL”或“MariaDB”的服务,或者其中包含某个版本号的服务。
您的 my.ini 在 [mysqld]
部分中包含两个端口定义,这可能意味着您的 Xamp/MySQL 仍然需要端口 3306,而忽略后面的 3308。这再次解释了为什么您的服务这样做如果您的 MariaDB 服务仍在运行,则不会启动。
不知道安装 MariaDB 的意图,我建议卸载它,或者至少将服务启动选项更改为手动
:
关于MySQL 无法在 XAMPP 和 HeidiSQL 上启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57173760/