MariaDB 将不会开始使用绑定挂载

MariaDB 将不会开始使用绑定挂载

在新安装的 Kubuntu 20.04 上全新安装 MariaDB。成功设置 MariaDB 并使用“库存”数据库后,它运行良好。然后我移动并重命名了 /var/lib/mysql 的原始内容,并使用绑定挂载将我的真实数据库带入新的 /var/lib/mysql 文件夹。重新启动后,真实数据库位于正确的文件夹中,具有正确的权限,但 MariaDB 服务器将不再启动。我已经在 Kubuntu 19.04、Kubuntu 19.10、Manjaro 等中成功使用了此过程。我无法使其与 Fedora 31、OpenSUSE、Mageia 等一起使用。
以下是 systemctl status mariadb 和 journalctl -xe 的输出:

Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2020-04-30 14:55:16 CEST; 12min ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 3343 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 3348 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 3362 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
    Process: 3411 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
   Main PID: 3411 (code=exited, status=1/FAILURE)

Apr 30 14:55:16 murphy systemd[1]: Starting MariaDB 10.3.22 database server...
Apr 30 14:55:16 murphy mysqld[3411]: 2020-04-30 14:55:16 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-1ubuntu1) starting as process 3411 ...
Apr 30 14:55:16 murphy systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Apr 30 14:55:16 murphy systemd[1]: mariadb.service: Failed with result 'exit-code'.
Apr 30 14:55:16 murphy systemd[1]: Failed to start MariaDB 10.3.22 database server.  


Starting MariaDB 10.3.22 database server...
-- Subject: A start job for unit mariadb.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mariadb.service has begun execution.
-- 
-- The job identifier is 2434.
Apr 30 15:20:18 murphy mysqld[3849]: 2020-04-30 15:20:18 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-1ubuntu1) starting as process 3849 ...
Apr 30 15:20:18 murphy systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit mariadb.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Apr 30 15:20:18 murphy systemd[1]: mariadb.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit mariadb.service has entered the 'failed' state with result 'exit-code'.
Apr 30 15:20:18 murphy systemd[1]: Failed to start MariaDB 10.3.22 database server.
-- Subject: A start job for unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mariadb.service has finished with a failure.
-- 
-- The job identifier is 2434 and the job result is failed.
Apr 30 15:21:13 murphy su[2897]: pam_unix(su:session): session closed for user root
Apr 30 15:21:13 murphy sudo[2896]: pam_unix(sudo:session): session closed for user root 

有人能帮我澄清一下吗?我需要提供更多信息吗?谢谢,
theber

Attie:这是 journalctl -u mariadb.service 的输出

-- Logs begin at Sat 2020-04-25 15:11:36 CEST, end at Thu 2020-04-30 20:46:28 CEST. --
 Apr 30 13:25:09 murphy systemd[1]: Starting MariaDB 10.3.22 database server...
Apr 30 13:25:09 murphy mysqld[4197]: 2020-04-30 13:25:09 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-1ubuntu1) starting as process 4197 ...
Apr 30 13:25:09 murphy systemd[1]: Started MariaDB 10.3.22 database server.
Apr 30 13:25:09 murphy /etc/mysql/debian-start[4233]: Upgrading MySQL tables if necessary.
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Looking for 'mysql' as: /usr/bin/mysql
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Phase 1/7: Checking and upgrading mysql database
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Processing databases
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.column_stats                                 OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.columns_priv                                 OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.db                                           OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.event                                        OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.func                                         OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.gtid_slave_pos                               OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.help_category                                OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.help_keyword                                 OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.help_relation                                OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.help_topic                                   OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.host                                         OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.index_stats                                  OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.innodb_index_stats                           OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.innodb_table_stats                           OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.plugin                                       OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.proc                                         OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.procs_priv                                   OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.proxies_priv                                 OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.roles_mapping                                OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.servers                                      OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.table_stats                                  OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.tables_priv                                  OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.time_zone                                    OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.time_zone_leap_second                        OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.time_zone_name                               OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.time_zone_transition                         OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.time_zone_transition_type                    OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.transaction_registry                         OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql.user                                         OK
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Phase 2/7: Installing used storage engines... Skipped
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Phase 3/7: Fixing views
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Processing databases
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: information_schema
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: performance_schema
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Phase 4/7: Running 'mysql_fix_privilege_tables'
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Phase 5/7: Fixing table and database names
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Processing databases
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: information_schema
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: mysql
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: performance_schema
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Phase 6/7: Checking and upgrading tables
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Processing databases
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: information_schema
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: performance_schema
Apr 30 13:25:10 murphy /etc/mysql/debian-start[4236]: Phase 7/7: Running 'FLUSH PRIVILEGES'

/var/log/mysql/error.log 的输出:

2020-05-01  8:50:24 0 [Note] InnoDB: Using Linux native AIO
2020-05-01  8:50:24 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-05-01  8:50:24 0 [Note] InnoDB: Uses event mutexes
2020-05-01  8:50:24 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-05-01  8:50:24 0 [Note] InnoDB: Number of pools: 1
2020-05-01  8:50:24 0 [Note] InnoDB: Using SSE2 crc32 instructions
2020-05-01  8:50:24 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-05-01  8:50:24 0 [Note] InnoDB: Completed initialization of buffer pool
2020-05-01  8:50:24 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriorit>
2020-05-01  8:50:24 0 [Note] InnoDB: Downgrading redo log: 2*50331648 bytes; LSN=22077728
2020-05-01  8:50:24 0 [Note] InnoDB: Starting to delete and rewrite log files.
2020-05-01  8:50:24 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 50331648 bytes
2020-05-01  8:50:24 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 50331648 bytes
2020-05-01  8:50:24 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2020-05-01  8:50:24 0 [Note] InnoDB: New log files created, LSN=22077728
2020-05-01  8:50:25 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-05-01  8:50:25 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-05-01  8:50:25 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-05-01  8:50:25 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-05-01  8:50:25 0 [Note] InnoDB: Waiting for purge to start
2020-05-01  8:50:25 0 [Note] InnoDB: 10.3.22 started; log sequence number 22077728; transaction id 31153
2020-05-01  8:50:25 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-05-01  8:50:25 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-05-01  8:50:25 0 [Note] Recovering after a crash using tc.log
2020-05-01  8:50:25 0 [Note] Starting crash recovery...
2020-05-01  8:50:25 0 [Note] Crash recovery finished.
2020-05-01  8:50:25 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-05-01  8:50:25 0 [ERROR] Fatal error: Can't open and lock privilege tables: 'mysql.user' is not of type 'TABLE'

答案1

你确定这个可以在 Manjaro 上与 MariaDB l 的版本完全相同的版本上运行吗?日志在问题中提到了 10.3.22。从我在 Manjaro 存储库中看到的内容来看,他们目前发布的版本是 10.4。

从 10.4 开始,所有系统表(包括用户表)都采用 Aria 格式,而在旧版本中则采用 MyISAM 格式。如果您尝试使用 10.3 或更早版本启动升级到 10.4 的数据库,我预计会出现这种错误。

相关内容