无法在 WSL2(Win10)Ubuntu 22.04 上启动 mariadb 服务

无法在 WSL2(Win10)Ubuntu 22.04 上启动 mariadb 服务

我正在尝试运行玛丽亚数据库服务Ubuntu 22.04WSL2但没有成功。MariaDB 服务无法启动。

环境:

  • 微软Windows[Version 10.0.19044.1645]
  • WSL2 具有Ubuntu-22.04
  • 内核版本:5.10.102.1

重现步骤:

  1. 从 Microsoft Store 安装 Ubuntu 22.04

  2. 从菜单开始运行 Ubuntu 22.04

  3. 执行sudo apt update

  4. 执行sudo apt upgrade

  5. 执行exit

  6. 从 Powershell运行wsl --shutdown以重新启动 WSL

  7. 从菜单“开始”再次运行 Ubuntu 22.04

  8. 执行sudo apt install mariadb-server mariadb-client

  9. 执行sudo service mariadb start

    问题来了:

    * Starting MariaDB database server mariadbd       [fail]
    

输出sudo mysqld --verbose --user root如下:

2022-05-11 18:38:35 0 [Note] mysqld (server 10.6.7-MariaDB-2ubuntu1) starting as process 458 ...
2022-05-11 18:38:35 0 [Note] InnoDB: The first data file './ibdata1' did not exist. A new tablespace will be created!
2022-05-11 18:38:35 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-05-11 18:38:35 0 [Note] InnoDB: Number of pools: 1
2022-05-11 18:38:35 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-05-11 18:38:35 0 [Note] InnoDB: Using liburing
2022-05-11 18:38:35 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2022-05-11 18:38:35 0 [Note] InnoDB: Completed initialization of buffer pool
2022-05-11 18:38:35 0 [Note] InnoDB: Setting file './ibdata1' size to 12 MB. Physically writing the file full; Please wait ...
2022-05-11 18:38:35 0 [Note] InnoDB: File './ibdata1' size is now 12 MB.
2022-05-11 18:38:35 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 100663296 bytes
2022-05-11 18:38:35 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2022-05-11 18:38:35 0 [Note] InnoDB: New log file created, LSN=10329
2022-05-11 18:38:35 0 [Note] InnoDB: Doublewrite buffer not found: creating new
2022-05-11 18:38:35 0 [Note] InnoDB: Doublewrite buffer created
2022-05-11 18:38:35 0 [Note] InnoDB: 128 rollback segments are active.
2022-05-11 18:38:35 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-05-11 18:38:35 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-05-11 18:38:35 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-05-11 18:38:35 0 [Note] InnoDB: 10.6.7 started; log sequence number 0; transaction id 3
2022-05-11 18:38:35 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-05-11 18:38:35 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
2022-05-11 18:38:35 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
2022-05-11 18:38:35 0 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
2022-05-11 18:38:35 0 [Note] Server socket created on IP: '127.0.0.1'.
2022-05-11 18:38:35 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.db' doesn't exist
2022-05-11 18:38:35 0 [ERROR] Aborting
Warning: Memory not freed: 280

输出sudo mysqld --verbose --user wzgf如下:

2022-05-11 18:41:41 0 [Note] mysqld (server 10.6.7-MariaDB-2ubuntu1) starting as process 496 ...
2022-05-11 18:41:41 0 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
2022-05-11 18:41:41 0 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2022-05-11 18:41:41 0 [ERROR] Plugin 'Aria' init function returned error.
2022-05-11 18:41:41 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2022-05-11 18:41:41 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2022-05-11 18:41:41 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2022-05-11 18:41:41 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-05-11 18:41:41 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-05-11 18:41:41 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-05-11 18:41:41 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
2022-05-11 18:41:41 0 [ERROR] Failed to initialize plugins.
2022-05-11 18:41:41 0 [ERROR] Aborting

补充说明:

  • Apache2 等其他服务运行良好
  • 在同一台机器上,使用 WSL2,安装之前的 Ubuntu(20.04),一切正常

答案1

看:https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/1969160

在 50-server.cnf 中设置 innodb_use_native_aio=0。您可能需要运行:sudo mysql_install_db --user=mysql

相关内容