質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Webサーバー

Webサーバーとは、HTTPリクエストに応じて、クライアントに情報を提供するシステムです。

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

MariaDB

MariaDBは、MySQL派生のオープンソースなリレーショナルデータベースシステムです。 また、MySQLとほぼ同じデータベースエンジンに対応しています。

Raspberry Pi

Raspberry Piは、ラズベリーパイ財団が開発した、名刺サイズのLinuxコンピュータです。 学校で基本的なコンピュータ科学の教育を促進することを意図しています。

Q&A

解決済

2回答

6322閲覧

RasPi+CentOSで,MariaDBが実行できない

tamasan238

総合スコア7

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Webサーバー

Webサーバーとは、HTTPリクエストに応じて、クライアントに情報を提供するシステムです。

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

MariaDB

MariaDBは、MySQL派生のオープンソースなリレーショナルデータベースシステムです。 また、MySQLとほぼ同じデータベースエンジンに対応しています。

Raspberry Pi

Raspberry Piは、ラズベリーパイ財団が開発した、名刺サイズのLinuxコンピュータです。 学校で基本的なコンピュータ科学の教育を促進することを意図しています。

0グッド

1クリップ

投稿2018/01/13 08:24

編集2018/01/14 09:04

###前提・実現したいこと
Raspberry Pi3 (model B)にCentOS7をインストールし,
MariaDB+Apache+WordPressでWebサーバを構築しようとしています.

一通りCentOSの設定(yumの有効化,Wi-Fiの有効化など)を行い,
MariaDBをインストールして起動しようとしたところでエラーが発生し起動できません.

###発生している問題・エラーメッセージ

systemctl start mariadb
と実行すると,
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
と返ってきます.

なお,systemctl enable mariadbを実行すると
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
と,正しく実行されます.

###試したこと
yum erase mariadb mariadb-server
で一旦削除し,
yum install mariadb mariadb-server
でインストールし直してみましたが,解消されませんでした.

###補足
LAN内のMacより,rootユーザーにSSHでログインしています.

systemctl status mariadb.serviceを実行すると以下のようになりました.

● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since 土 2018-01-13 17:34:13 JST; 3min 22s ago Process: 780 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=1/FAILURE) 1月 13 17:34:13 centos-rpi3 mariadb-prepare-db-dir[780]: /var/lib/mysql for more information. 1月 13 17:34:13 centos-rpi3 mariadb-prepare-db-dir[780]: The problem could be conflicting information in an external 1月 13 17:34:13 centos-rpi3 mariadb-prepare-db-dir[780]: my.cnf files. You can ignore these by doing: 1月 13 17:34:13 centos-rpi3 mariadb-prepare-db-dir[780]: shell> /usr/bin/scripts/mysql_install_db --defaults-file=~/.my.cnf 1月 13 17:34:13 centos-rpi3 mariadb-prepare-db-dir[780]: You can also try to start the mysqld daemon with: 1月 13 17:34:13 centos-rpi3 mariadb-prepare-db-dir[780]: shell> /usr/libexec/mysqld --skip-grant --general-log & 1月 13 17:34:13 centos-rpi3 systemd[1]: mariadb.service: control process exited, code=exited status=1 1月 13 17:34:13 centos-rpi3 systemd[1]: Failed to start MariaDB database server. 1月 13 17:34:13 centos-rpi3 systemd[1]: Unit mariadb.service entered failed state. 1月 13 17:34:13 centos-rpi3 systemd[1]: mariadb.service failed.

journalctl -u mariadb.serviceを実行すると以下のようになりました。

Last login: Sun Jan 14 09:20:32 2018 from 192.168.0.161 [root@centos-rpi3 ~]# journalctl -u mariadb.service --no-pager -- Logs begin at 木 1970-01-01 09:00:03 JST, end at 日 2018-01-14 10:21:46 JST. -- 1月 01 09:00:17 centos-rpi3 systemd[1]: Starting MariaDB database server... 1月 01 09:00:17 centos-rpi3 mariadb-prepare-db-dir[414]: Initializing MariaDB database 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: 700101 9:00:19 [Note] /usr/libexec/mysqld (mysqld 5.5.56-MariaDB) starting as process 582 ... 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: [146B blob data] 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: 700101 9:00:19 [ERROR] Aborting 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: 700101 9:00:19 [Note] /usr/libexec/mysqld: Shutdown complete 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: Installation of system tables failed! Examine the logs in 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: /var/lib/mysql for more information. 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: The problem could be conflicting information in an external 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: my.cnf files. You can ignore these by doing: 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: shell> /usr/bin/scripts/mysql_install_db --defaults-file=~/.my.cnf 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: You can also try to start the mysqld daemon with: 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: shell> /usr/libexec/mysqld --skip-grant --general-log & 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: and use the command line tool /usr/bin/mysql 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: to connect to the mysql database and look at the grant tables: 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: shell> /usr/bin/mysql -u root mysql 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: mysql> show tables; 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: Try 'mysqld --help' if you have problems with paths. Using 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: --general-log gives you a log in /var/lib/mysql that may be helpful. 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: The latest information about mysql_install_db is available at 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: https://mariadb.com/kb/en/installing-system-tables-mysql_install_db 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: MariaDB is hosted on launchpad; You can find the latest source and 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: email lists at http://launchpad.net/maria 1月 01 09:00:19 centos-rpi3 mariadb-prepare-db-dir[414]: Please check all of the above before submitting a bug report 1月 01 09:00:19 centos-rpi3 systemd[1]: mariadb.service: control process exited, code=exited status=1 1月 01 09:00:19 centos-rpi3 systemd[1]: Failed to start MariaDB database server. 1月 01 09:00:19 centos-rpi3 systemd[1]: Unit mariadb.service entered failed state. 1月 01 09:00:19 centos-rpi3 systemd[1]: mariadb.service failed. [root@centos-rpi3 ~]#

dfコマンドを実行するとこうなりました。

[root@centos-rpi3 ~]# df ファイルシス 1K-ブロック 使用 使用可 使用% マウント位置 /dev/root 29723628 1191688 27284044 5% / devtmpfs 470168 0 470168 0% /dev tmpfs 474776 0 474776 0% /dev/shm tmpfs 474776 12180 462596 3% /run tmpfs 474776 0 474776 0% /sys/fs/cgroup /dev/mmcblk0p1 511720 50672 461048 10% /boot tmpfs 94956 0 94956 0% /run/user/0

以下、/var/log/messagesの該当箇所です。

Jan 14 17:43:16 centos-rpi3 systemd: Starting MariaDB database server... Jan 14 17:43:16 centos-rpi3 mariadb-prepare-db-dir: Initializing MariaDB database Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: 180114 17:43:17 [Note] /usr/libexec/mysqld (mysqld 5.5.56-MariaDB) starting as process 9775 ... Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: #007/usr/libexec/mysqld: Character set 'utf-8' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: 180114 17:43:17 [ERROR] Aborting Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: 180114 17:43:17 [Note] /usr/libexec/mysqld: Shutdown complete Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: Installation of system tables failed! Examine the logs in Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: /var/lib/mysql for more information. Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: The problem could be conflicting information in an external Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: my.cnf files. You can ignore these by doing: Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: shell> /usr/bin/scripts/mysql_install_db --defaults-file=~/.my.cnf Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: You can also try to start the mysqld daemon with: Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: shell> /usr/libexec/mysqld --skip-grant --general-log & Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: and use the command line tool /usr/bin/mysql Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: to connect to the mysql database and look at the grant tables: Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: shell> /usr/bin/mysql -u root mysql Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: mysql> show tables; Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: Try 'mysqld --help' if you have problems with paths. Using Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: --general-log gives you a log in /var/lib/mysql that may be helpful. Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: The latest information about mysql_install_db is available at Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: https://mariadb.com/kb/en/installing-system-tables-mysql_install_db Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: MariaDB is hosted on launchpad; You can find the latest source and Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: email lists at http://launchpad.net/maria Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: Please check all of the above before submitting a bug report Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: at http://mariadb.org/jira Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: Initialization of MariaDB database failed. Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: Perhaps @sysconfdir@/my.cnf is misconfigured or there is some problem with permissions of /var/lib/mysql. Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: Initialization of MariaDB database was not finished successfully. Jan 14 17:43:17 centos-rpi3 mariadb-prepare-db-dir: Files created so far will be removed. Jan 14 17:43:17 centos-rpi3 systemd: mariadb.service: control process exited, code=exited status=1 Jan 14 17:43:17 centos-rpi3 systemd: Failed to start MariaDB database server. Jan 14 17:43:17 centos-rpi3 systemd: Unit mariadb.service entered failed state. Jan 14 17:43:17 centos-rpi3 systemd: mariadb.service failed.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2018/01/13 08:34

systemctl status mariadb.serviceの実行結果はどうなんでしょう?
退会済みユーザー

退会済みユーザー

2018/01/13 08:45

起動失敗後、tail /var/log/mariadb/mariadb.logでどう出ますか?
tamasan238

2018/01/13 08:54

実行しましたが表示されなかったため該当のディレクトリをls -lで見てみましたところ,バイトサイズが0となっていました.
mit0223

2018/01/13 23:51

journalctl -u mariadb.service の結果を貼ってもらえませんか。貼る際は「コード」として貼ってください。
mit0223

2018/01/14 01:11

すみません、journalctl の結果ですが、肝心のところが切れてしまっています。お手数ですが、 journalctl -u mariadb.service --no-pager でやり直してもらえませんでしょうか。
mit0223

2018/01/14 03:57

どうもぐぐってみると領域不足の可能性があるようです。お手数ですが、 df コマンドの結果も貼ってもらえますでしょうか。
tamasan238

2018/01/14 09:10

質問に追記致しました。お手数おかけしてすみません
tamasan238

2018/01/14 17:45

私が設定ファイルを編集した際,"utf8"と書くべきところを"utf-8"と書いていたせいで起動しない事態に陥っていたことが判明しました.すみません.ここまでご協力頂きまして誠にありがとうございました.
mit0223

2018/01/15 00:40

あ、自己解決したのであれば、自分で回答を入力して修正内容を示してください。後で同じトラブルに陥った人が見に来るかもしれませんので。
mit0223

2018/01/15 00:48

今回貼っていただいたログで、私の知らなかった発見がありました。/var/log/messages は基本的に journalctl と同じ内容が入っているだけのはずですが、肝心の utf-8 に関するメッセージが journalctl では [146B blob data] となっていて、見えない状態でした。見えるようにするためには -a オプションが必要だそうです。
guest

回答2

0

自己解決

設定ファイルを編集した際,"utf8"と書くべきところを"utf-8"と書いていました.
該当箇所を"utf8"と直して再起動し,再び実行したところ,正常に動作するようになりました.

こちらへの記入が遅くなりすみません.

投稿2018/03/27 11:42

tamasan238

総合スコア7

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

以下、試してみてください。

yum -y remove mariadb rm -rf /var/lib/mysql yum -y install mariadb-server

/var/log/messagesにmy.cnfがおかしいと書いてあるので見直してください。

これでいいですか?

投稿2018/01/13 09:00

編集2018/01/15 02:04
退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

tamasan238

2018/01/13 09:08

ありがとうございます. 実行してみましたが,実行前と同一のエラーが吐かれてしまいました.
tamasan238

2018/01/13 09:09

ログも同じ状況でした
退会済みユーザー

退会済みユーザー

2018/01/13 09:16

lsof -i:3306の結果はどうなりますか? not foundになったら yum -y install lsof
tamasan238

2018/01/13 09:18

インストール後実行しましたが,何も表示されず次のコマンドを入力する状態になりました.
退会済みユーザー

退会済みユーザー

2018/01/13 09:23

>次のコマンドを入力する状態になりました ???ですが では getenforce の結果が Enforcing ならSELinuxが有効なので setenforce 0 を実行してSELinuxを一時的に無効にしてMariaDBが起動するか試してください。 SELinuxが不要なら vi /etc/selinux/config SELINUX=enforcing ↓ SELINUX=disabled で無効にできます。
tamasan238

2018/01/14 00:30

すみません、知識不足なもので… [root@centos-rpi3 ~]# と表示された状態のことを指していました。 SELINUXですが、getenforceの時点でPermissiveと出ました。
退会済みユーザー

退会済みユーザー

2018/01/14 00:43

setenforce 0 を実行してDBが起動するか試してください。
tamasan238

2018/01/14 01:29

行いましたが、起動には至らず以前と同じエラーが吐かれました
退会済みユーザー

退会済みユーザー

2018/01/14 03:39

起動失敗時に/var/log/messagesに何か出てませんか?
tamasan238

2018/01/14 09:05

長いため、質問本文に追記致しました。 ご確認頂けますと幸いです。 お手数おかけしてすみません。
退会済みユーザー

退会済みユーザー

2018/01/14 09:39

my.cnfがおかしいように書いてますが、どのような設定をしますか? /etc/my.cnfを触ってますか? 設定ファイルは /etc/my.cnf.d/server.cnfじゃないですか?
tamasan238

2018/01/14 17:43 編集

/etc/my.cnfで文字コードの設定を行っていました. 改めて確認したところ, character-set-server=utf8 と書くべきところを character-set-server=utf-8 と書いてしまっており,訂正して保存後, systemctl start mariadb で無事起動しました. 私のミスのせいでここまでお時間を頂くことになってしまいすみませんでした. 数々の情報を下さいまして誠にありがとうございました. 別の回答として入力して頂ければそちらをベストアンサーとしますので,もしよろしければよろしくお願い致します.
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問