MariaDBに接続しようとしたときにエラー2002(HY000)が発生する

MariaDBに接続しようとしたときにエラー2002(HY000)が発生する

私はLinux Mint 19を使用しており、MariaDBをlocalhostのWordPressサイト用のデータベースサーバーとして使用しています。

MariaDBを実行して実行状態を確認すると systemctl status mysql.service

次のメッセージが表示されます。


● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; generated)
   Active: failed (Result: exit-code) since Fri 2020-07-24 21:00:26 IDT; 44s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2566 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

juil. 24 20:59:56 burslf mysqld[2810]: 2020-07-24 20:59:56 0 [Note] InnoDB: Transaction contains changes to 1 rows
juil. 24 20:59:56 burslf mysqld[2810]: 2020-07-24 20:59:56 0 [Note] InnoDB: 1 transactions in prepared state after recovery
juil. 24 20:59:56 burslf mysqld[2810]: 2020-07-24 20:59:56 0 [Note] Found 1 prepared transaction(s) in InnoDB
juil. 24 20:59:56 burslf mysqld[2810]: 2020-07-24 20:59:56 0 [ERROR] Found 1 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery informati
juil. 24 20:59:56 burslf mysqld[2810]: 2020-07-24 20:59:56 0 [ERROR] Aborting
juil. 24 20:59:56 burslf mysqld[2810]: 
juil. 24 21:00:26 burslf mysql[2566]:    ...fail!
juil. 24 21:00:26 burslf systemd[1]: mysql.service: Control process exited, code=exited status=1
juil. 24 21:00:26 burslf systemd[1]: mysql.service: Failed with result 'exit-code'.
juil. 24 21:00:26 burslf systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.

開始すると、journalctl -xe次のようになります。

juil. 24 20:55:31 burslf mysqld[9689]: 2020-07-24 20:55:31 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:32 burslf audit[1482]: AVC apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" 
juil. 24 20:55:32 burslf mysqld[1482]: 2020-07-24 20:55:32 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
juil. 24 20:55:32 burslf kernel: audit: type=1400 audit(1595613332.089:156): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
juil. 24 20:55:32 burslf mysqld[9689]: 2020-07-24 20:55:32 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:32 burslf mysqld[9689]: 2020-07-24 20:55:32 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:33 burslf mysqld[9689]: 2020-07-24 20:55:33 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:33 burslf mysqld[9689]: 2020-07-24 20:55:33 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:34 burslf mysqld[9689]: 2020-07-24 20:55:34 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:34 burslf mysqld[9689]: 2020-07-24 20:55:34 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:35 burslf mysqld[9689]: 2020-07-24 20:55:35 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:35 burslf mysqld[9689]: 2020-07-24 20:55:35 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:36 burslf mysqld[9689]: 2020-07-24 20:55:36 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:36 burslf mysqld[9689]: 2020-07-24 20:55:36 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:37 burslf mysqld[9689]: 2020-07-24 20:55:37 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:37 burslf mysqld[9689]: 2020-07-24 20:55:37 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:38 burslf mysqld[9689]: 2020-07-24 20:55:38 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:38 burslf mysqld[9689]: 2020-07-24 20:55:38 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:39 burslf mysqld[9689]: 2020-07-24 20:55:39 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:39 burslf mysqld[9689]: 2020-07-24 20:55:39 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:40 burslf mysqld[9689]: 2020-07-24 20:55:40 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:40 burslf mysqld[9689]: 2020-07-24 20:55:40 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:41 burslf mysqld[9689]: 2020-07-24 20:55:41 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:41 burslf mysqld[9689]: 2020-07-24 20:55:41 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [Note] InnoDB: Unable to open the first data file
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Operating system error number 11 in a file operation.
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Error number 11 means 'Resource temporarily unavailable'
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-cod
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Cannot open datafile './ibdata1'
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Plugin initialization aborted with error Cannot open a file
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [Note] InnoDB: Starting shutdown...
juil. 24 20:55:43 burslf audit[9689]: AVC apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" 
juil. 24 20:55:43 burslf kernel: audit: type=1400 audit(1595613343.029:157): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
juil. 24 20:55:43 burslf mysqld[9689]: 2020-07-24 20:55:43 0 [ERROR] Plugin 'InnoDB' init function returned error.
juil. 24 20:55:43 burslf mysqld[9689]: 2020-07-24 20:55:43 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
juil. 24 20:55:43 burslf mysqld[9689]: 2020-07-24 20:55:43 0 [Note] Plugin 'FEEDBACK' is disabled.
juil. 24 20:55:43 burslf mysqld[9689]: 2020-07-24 20:55:43 0 [ERROR] Unknown/unsupported storage engine: InnoDB
juil. 24 20:55:43 burslf mysqld[9689]: 2020-07-24 20:55:43 0 [ERROR] Aborting
juil. 24 20:55:43 burslf mysqld[9689]: Warning: Memory not freed: 520
juil. 24 20:55:43 burslf audit[9689]: AVC apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" 
juil. 24 20:55:43 burslf audit[9689]: AVC apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="dev/null" pid=9689 c
juil. 24 20:55:43 burslf audit[9689]: AVC apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="dev/null" pid=9689 c
juil. 24 20:55:43 burslf audit[9689]: AVC apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="dev/null" pid=9689 c
juil. 24 20:55:43 burslf systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
juil. 24 20:55:43 burslf kernel: audit: type=1400 audit(1595613343.409:158): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
juil. 24 20:55:43 burslf kernel: audit: type=1400 audit(1595613343.409:159): apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
juil. 24 20:55:43 burslf kernel: audit: type=1400 audit(1595613343.409:160): apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
juil. 24 20:55:43 burslf kernel: audit: type=1400 audit(1595613343.409:161): apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin

ベストアンサー1

最大の問題は、InnoDBエンジンが正しく初期化されていないことです。明らかにすでに実行中です。この回答は次のようになりました。https://stackoverflow.com/a/35978229/1525392

まず、psコマンドを使用してMySQLプロセスを一覧表示します。

ps aux | grep mysql

ここに画像の説明を入力してください。

その後、プロセスを終了します。

sudo kill 56311

おすすめ記事