gpt4 book ai didi

来自旧硬盘系统的 mysql datadir 无法启动

转载 作者:可可西里 更新时间:2023-11-01 09:00:30 27 4
gpt4 key购买 nike

我正在尝试将 mysql 数据库从装有 fedora9(不再启动)的旧驱动器迁移到 ubuntu 16.04 服务器。

我把旧系统的/var/lib/mysql文件夹复制到新系统的/testdb/mysql中。

我将所有者更改为 mysql:mysql 到新文件夹并将 my.conf 的 datadir 更新到这个新文件夹,但是 mysql 服务器不再启动。我收到以下错误:

170625 12:44:37 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
170625 12:44:37 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
170625 12:44:37 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
170625 12:44:37 InnoDB: The InnoDB memory heap is disabled
170625 12:44:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170625 12:44:37 InnoDB: Compressed tables use zlib 1.2.8
170625 12:44:37 InnoDB: Using Linux native AIO
170625 12:44:37 InnoDB: Initializing buffer pool, size = 128.0M
170625 12:44:37 InnoDB: Completed initialization of buffer pool
170625 12:44:37 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
170625 12:44:38 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
170625 12:44:38 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
170625 12:44:38 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
170625 12:44:38 InnoDB: The InnoDB memory heap is disabled
170625 12:44:38 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170625 12:44:38 InnoDB: Compressed tables use zlib 1.2.8
170625 12:44:38 InnoDB: Using Linux native AIO
170625 12:44:38 InnoDB: Initializing buffer pool, size = 128.0M
170625 12:44:38 InnoDB: Completed initialization of buffer pool
170625 12:44:38 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
170625 12:44:38 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
170625 12:44:38 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
170625 12:44:38 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
170625 12:44:38 InnoDB: The InnoDB memory heap is disabled
170625 12:44:38 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170625 12:44:38 InnoDB: Compressed tables use zlib 1.2.8
170625 12:44:38 InnoDB: Using Linux native AIO
170625 12:44:38 InnoDB: Initializing buffer pool, size = 128.0M
170625 12:44:38 InnoDB: Completed initialization of buffer pool
170625 12:44:38 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

我尝试更改所有权限,甚至更改所有文件的 777(只是为了尝试),但总是得到相同的结果。

如何恢复数据库?

最佳答案

我终于找到了恢复表的方法,它没有从 my.conf 更改数据目录(它没有用,即使复制默认数据库的内容也能正常工作),我复制了我想要的文件夹恢复到默认数据目录,覆盖除 mysql.sock 和 mysql 文件夹之外的所有文件。然后我启动了 mysql 服务器并且它可以工作,但是一些表应该用

mysqlcheck --repair --all-databases -u root -p 

现在一切正常

关于来自旧硬盘系统的 mysql datadir 无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44750086/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com