2017-06-25 9 views
3

私はfedora9(それ以上起動しなかった古いドライブ)からubuntu 16.04サーバにmysqlデータベースを移行しようとしています。古いハードドライブシステムからのmysql datadirは起動しません

新しいシステムの古いシステムの/ 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すべてのファイルに、すべての権限を変更しようとしましたが、常に同じ結果を持っています。

どのようにデータベースを回復できますか?

+0

正常に動作します所有者をmysql:mysql(sudo chown -R mysql:mysql/testdb/mysql)に変更しました。この最初の変更がうまくいかないので、私はすべての権限を777に変更しようとしました。(ユーザとグループとしてmysqlを保存しています) – togarha

+0

ibdataファイルのユーザとアクセス権:-rwxrwxrwx 1 mysql mysql 18874368 jun 25 12:22 ibdata1' – togarha

+0

新しいテスト'/ var/lib/mysql'のテスト用データベースを使ってデフォルトのフォルダをうまく動作させてから' sudo mkdir/var/liv'という名前のユーザとグループを持つ 'root:root'を作成しました。 'sudo cp -rp/var/lib/mysql/var/liv'ディレクトリにmysqlをコピーして、新しいディレクトリにコピーしました。/etc/mysql/my.cnfから 'datadir =/var/liv/mysql'にcnfするとmysqlはもう起動しませんでした(その後、フォルダが正しく変更されていると思いますが、何かが失敗します) – togarha

答えて

0

私は最終的にテーブルを回復する方法を見つけました。それはmy.confからdatadirを変更していません(それはうまく動作しませんでした。デフォルトデータベースの内容をコピーしても機能しませんでした) mysql.sockとmysqlフォルダ以外のすべてのファイルを上書きして、デフォルトのdatadirに回復したい。 は、それから私は、MySQLサーバを開始し、それが動作しますが、いくつかのテーブルが

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

で修復するためにはなら今すべては、私が質問に入れたように、私の最初のステップは、後にフォルダをコピーBK435 @

関連する問題