首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mariadb升级问题

Mariadb升级问题
EN

Database Administration用户
提问于 2023-03-23 16:22:42
回答 1查看 44关注 0票数 0

我在Centos 7框上将mariadb从5.5升级到10.5,在更新表之后,mariadb将不再启动。在/var/log/messages中,我得到以下错误。任何帮助都将不胜感激!

代码语言:javascript
复制
Mar 23 10:22:20 theo systemd: Starting MariaDB 10.5.19 database server...
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] Starting MariaDB 10.5.19-MariaDB source revision f8a85af8ca1c937b8d4f847477bd282f80251cde as process 15269
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Uses event mutexes
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Compressed tables use zlib 1.2.7
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Number of pools: 1
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Using Linux native AIO
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Completed initialization of buffer pool
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: 128 rollback segments are active.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/gtid_slave_pos.ibd' OS error: 81
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`gtid_slave_pos``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Warning] InnoDB: Ignoring tablespace for `mysql`.`gtid_slave_pos` because it could not be opened.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/innodb_index_stats.ibd' OS error: 81
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`innodb_index_stats``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Warning] InnoDB: Ignoring tablespace for `mysql`.`innodb_index_stats` because it could not be opened.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/innodb_table_stats.ibd' OS error: 81
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`innodb_table_stats``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Warning] InnoDB: Ignoring tablespace for `mysql`.`innodb_table_stats` because it could not be opened.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/transaction_registry.ibd' OS error: 81
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`transaction_registry``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Warning] InnoDB: Ignoring tablespace for `mysql`.`transaction_registry` because it could not be opened.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Creating shared tablespace for temporary tables
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: 10.5.19 started; log sequence number 63339738232; transaction id 664540336
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] Plugin 'FEEDBACK' is disabled.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] InnoDB: Buffer pool(s) load completed at 230323 10:22:20
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [Note] Server socket created on IP: '::'.
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.db' doesn't exist
Mar 23 10:22:20 theo mariadbd: 2023-03-23 10:22:20 0 [ERROR] Aborting
Mar 23 10:22:20 theo systemd: mariadb.service: main process exited, code=exited, status=1/FAILURE
Mar 23 10:22:20 theo systemd: Failed to start MariaDB 10.5.19 database server.
Mar 23 10:22:20 theo systemd: Unit mariadb.service entered failed state.
Mar 23 10:22:20 theo systemd: mariadb.service failed.
EN

回答 1

Database Administration用户

回答已采纳

发布于 2023-03-25 12:48:27

更新表后,mariadb将不再启动。

听起来,您可能与错误的用户一起运行了更新,或者以某种方式使相关系统用户(默认系统用户为mysql)的数据目录不可读和/或不可写。也许您已经丢失了(某些)文件的SELinux上下文?

您可能可以通过运行几个命令来递归地设置所有权、权限和SELinux上下文来解决这个问题:

代码语言:javascript
复制
sudo chown -R mysql:mysql /var/lib/mysql
sudo find /var/lib/mysql -type d -exec chmod u=rwx,go= {} \;
sudo find /var/lib/mysql -type f -exec chmod ug=rw,o= {} \;
sudo semanage fcontext -a -t mysqld_db_t "/var/lib/mysql(/.*)?"
sudo restorecon -Rv /var/lib/mysql

以上假设您的datadir具有默认位置/var/lib/mysql/。(从问题中的错误日志输出判断,您确实在使用此方法。)

有关SELinux文章的更多详细信息,请参阅MariaDB KB文档中的SELinux。

票数 1
EN
页面原文内容由Database Administration提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://dba.stackexchange.com/questions/325085

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档