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

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

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

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

MariaDB

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

Q&A

解決済

1回答

10590閲覧

MariaDBがfailedと出てしまい、起動失敗。

A.T

総合スコア7

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

MariaDB

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

0グッド

0クリップ

投稿2020/06/30 02:57

編集2020/06/30 04:46

MariaDBをインストールし、起動させたいのですが、状態確認のコマンド実行後にfailedと出てしまい、困っています。

systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 火 2020-06-30 13:05:24 JST; 2s ago
Process: 2375 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=1/FAILURE)

6月 30 13:05:24 dbsv2 systemd[1]: Starting MariaDB database server...
6月 30 13:05:24 dbsv2 mariadb-prepare-db-dir[2375]: mkdir: ディレクトリ `/opt/mysql' を作成できません: 許可がありません
6月 30 13:05:24 dbsv2 systemd[1]: mariadb.service: control process exited, code=exited status=1
6月 30 13:05:24 dbsv2 systemd[1]: Failed to start MariaDB database server.
6月 30 13:05:24 dbsv2 systemd[1]: Unit mariadb.service entered failed state.
6月 30 13:05:24 dbsv2 systemd[1]: mariadb.service failed.
[root@dbsv2 ~]#

Linux MariaDB```

試したこと

・mariadbを初期化、ディレクトリ(/var/lib/mysqlと/opt/mysql)を削除し、再インストール
・/opt/mysqlで移動し、コマンド実行
・cd /var/lib/mysqlで移動し、コマンド実行

補足情報(FW/ツールのバージョンなど)

※ディレクトリに関しては特に設定はしておりません。デフォルトで/var/lib/mysqlになるようです。

mariadbインストール手順
⓵マウント
mount /dev/cdrom /mnt
mount: /dev/sr0 is write-protected, mounting read-only
mount: /dev/sr0 is already mounted or /mnt busy
/dev/sr0 is already mounted on /mnt
⓶リポジトリ作成

vi /etc/yum.repos.d/Local_DVD.repo

cat Local_DVD.repo

[Local_DVD]
name=Local_DVD
baseurl=file:///mnt
enabled=1
gpgcheck=1
gpgkey=file:///mnt/RPM-GPG-KEY-redhat-release
[root@dbsv2 yum.repos.d]#
⓷yumさせる

yum search zsh

読み込んだプラグイン:product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
=============================== N/S matched: zsh ===============================
zsh.x86_64 : Powerful interactive shell

Name and summary matches only, use "search all" for everything.
⓸# yum search mariadb
読み込んだプラグイン:product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
============================= N/S matched: mariadb =============================
mariadb-bench.x86_64 : MariaDB benchmark scripts and data
mariadb-devel.i686 : Files for development of MariaDB/MySQL applications
mariadb-devel.x86_64 : Files for development of MariaDB/MySQL applications
mariadb-libs.i686 : The shared libraries required for MariaDB/MySQL clients
mariadb-libs.x86_64 : The shared libraries required for MariaDB/MySQL clients
mariadb-server.x86_64 : The MariaDB server and related files
mariadb.x86_64 : A community developed branch of MySQL
mariadb-test.x86_64 : The test suite distributed with MariaD

Name and summary matches only, use "search all" for everything.
⓹インストール

yum install mariadb

読み込んだプラグイン:product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Local_DVD | 4.1 kB 00:00
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ mariadb.x86_64 1:5.5.52-1.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

================================================================================
Package アーキテクチャー
バージョン リポジトリー 容量

インストール中:
mariadb x86_64 1:5.5.52-1.el7 Local_DVD 8.6 M

トランザクションの要約

インストール 1 パッケージ

総ダウンロード容量: 8.6 M
インストール容量: 49 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
インストール中 : 1:mariadb-5.5.52-1.el7 [ ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [# ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [## ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [#### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [##### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [###### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [####### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [######## ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [######### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [########## ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [########### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [############ ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [############# ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [############## ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [############### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [################ ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [################# ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [################## ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [################### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [#################### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7 [##################### ] 1/1 インストール中 : 1:mariadb-5.5.52-1.el7.x86_64 1/1
検証中 : 1:mariadb-5.5.52-1.el7.x86_64 1/1

インストール:
mariadb.x86_64 1:5.5.52-1.el7

完了しました!
[root@dbsv2 ~]# yum list installed mariadb
読み込んだプラグイン:product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
インストール済みパッケージ
mariadb.x86_64 1:5.5.52-1.el7 @Local_DVD
[root@dbsv2 ~]# cd /mnt

⓺rpmコマンドでインストール。研修課題でrpmからもインストールしてみるという目的でyumでインストールしたmariadb-serverを一回削除し、再びrpmでインストール。

[root@dbsv2 Packages]# ls maria*
mariadb-5.5.52-1.el7.x86_64.rpm mariadb-libs-5.5.52-1.el7.i686.rpm
mariadb-bench-5.5.52-1.el7.x86_64.rpm mariadb-libs-5.5.52-1.el7.x86_64.rpm
mariadb-devel-5.5.52-1.el7.i686.rpm mariadb-server-5.5.52-1.el7.x86_64.rpm
mariadb-devel-5.5.52-1.el7.x86_64.rpm mariadb-test-5.5.52-1.el7.x86_64.rpm
[root@dbsv2 Packages]# rpm -ivh mariadb-server-5.5.52-1.el7.x86_64.rpm
準備しています... (100%)# (100%)## (100%)### (100%)#### (100%)##### (100%)###### (100%)####### (100%)######## (100%)######### (100%)########## (100%)########### (100%)############ (100%)############# (100%)############## (100%)############### (100%)################ (100%)################# (100%)################## (100%)################### (100%)#################### (100%)##################### (100%)###################### (100%)####################### (100%)######################## (100%)######################### (100%)########################## (100%)########################### (100%)############################ (100%)############################# (100%)############################## (100%)############################### (100%)################################ (100%)################################# (100%)################################# [100%]
更新中 / インストール中...
1:mariadb-server-1:5.5.52-1.el7 ( 1%)# ( 4%)## ( 7%)### ( 10%)#### ( 13%)##### ( 16%)###### ( 19%)####### ( 22%)######## ( 25%)######### ( 28%)########## ( 31%)########### ( 34%)############ ( 37%)############# ( 40%)############## ( 43%)############### ( 46%)################ ( 49%)################# ( 51%)################## ( 54%)################### ( 57%)#################### ( 60%)##################### ( 63%)###################### ( 66%)####################### ( 69%)######################## ( 72%)######################### ( 75%)########################## ( 78%)########################### ( 81%)############################ ( 84%)############################# ( 87%)############################## ( 90%)############################### ( 93%)################################ ( 96%)################################# ( 99%)################################# [100%]
[root@dbsv2 Packages]# rpm -qa |grep mariadb-server*
[root@dbsv2 Packages]# rmumount /mnt
umount: /mnt: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[root@dbsv2 Packages]# cd
[root@dbsv2 ~]#

エラーメッセージが表示されているのですが、原因がわからず、起動させる場所に問題があるのでしょうか?

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

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

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

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

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

A.T

2020/06/30 04:07

失礼しました。修正致しました。
yukky1201

2020/06/30 04:12

「/opt/mysql' を作成できません: 許可がありません」と出てますが、該当のディレクトリを使用するような設定を実施している場合、情報を提供してください。
A.T

2020/06/30 04:20

承知致しました。特に設定はしておりません。デフォルトだと/var/lib/mysqlになるようです。
yukky1201

2020/06/30 04:26

そうですね、デフォルトは/var/lib/mysqの想定ですが。。。 環境やどのようにインストールしたか不明なので、下記を質問に追記してください OSのバージョン MariaDBのバージョン MariaDBのインストール手順(実行したコマンドや使用したインストールファイル名など) MariaDBの設定ファイルの内容
A.T

2020/06/30 04:46

失礼いたしました。 字数オーバーのため、残りはこちらで報告させて頂きます。 # cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.3 (Maipo) # yum list installed mariadb-server 読み込んだプラグイン:product-id, search-disabled-repos, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. インストール済みパッケージ mariadb-server.x86_64 1:5.5.52-1.el7 installed
yukky1201

2020/06/30 05:52

MariaDBの設定ファイルの内容も提示してください
guest

回答1

0

自己解決

お手数をおかけし、申し訳ございません。
解決出来ました。
原因は設定ファイルmy.confの中身、datadirとsocketの設定ファイルが/var/lib/mysqlを設定していなかったことでした。設定修正後、再起動したことで無事起動できました。
至らない質問にアドバイスまでしてくださり、ありがとうございました。

以下内容に修正しました。
#datadir=/var/lib/mysql
datadir=/opt/mysql
#socket=/var/lib/mysql/mysql.sock
socket=/opt/mysql/mysql.sock

Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

Settings user and group are ignored when systemd is used.

If you need to run mysqld under a different user or group,

customize your systemd unit file for mariadb according to the

instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

include all files from the config directory

!includedir /etc/my.cnf.d

[mysqld]
skip-character-set-client-handshake
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = SET NAMES utf8

[client]
default-character-set = utf8
~~socket=/opt/mysql/mysql.sock
~~
[mysqldump]
default-character-set = utf8

[mysql]
default-character-set = utf8

投稿2020/06/30 06:19

A.T

総合スコア7

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問