CentOS 7.1.1503にMariaDBをインストールし、systemctl start mysqlをしましたが起動できませんでした。

こちらのサイトを参考に作業しました。
http://love-zawa.hatenablog.com/entry/2014/07/24/CentOS_6_5%E3%81%ABMariaDB_10_0_12%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB(yum%E3%82%92%E4%BD%BF%E7%94%A8)

# vim /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0.20/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
enabled=1

これで問題なければインストールは完了です。「Transaction Check Error:」とかが出たら、mysql-libsを削除すると良いそうな。

途中Transaction Check Error:が出てしまったのでmysql-libsは削除しました。

systemctl start mysqlの結果は

# systemctl start mysql
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.

systemctl status mysqlとかjournalctl -xnの結果は

# systemctl status mysql
mysql.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/rc.d/init.d/mysql)
   Active: failed (Result: exit-code) since 水 2015-07-01 12:12:03 JST; 6min ago
  Process: 6341 ExecStart=/etc/rc.d/init.d/mysql start (code=exited, status=1/FAILURE)

 7月 01 12:12:02 localhost.localdomain systemd[1]: Starting LSB: start and stop MySQL...
 7月 01 12:12:03 localhost.localdomain mysql[6341]: Starting MySQL. ERROR!
 7月 01 12:12:03 localhost.localdomain systemd[1]: mysql.service: control process exited, code=exited status=1
 7月 01 12:12:03 localhost.localdomain systemd[1]: Failed to start LSB: start and stop MySQL.
 7月 01 12:12:03 localhost.localdomain systemd[1]: Unit mysql.service entered failed state.


# journalctl -xn
-- Logs begin at 水 2015-07-01 01:58:42 JST, end at 水 2015-07-01 12:20:01 JST. --
 7月 01 12:17:12 localhost.localdomain avahi-daemon[597]: Withdrawing address record for fe80::a00:27ff:fe51:68d4
 7月 01 12:19:29 localhost.localdomain systemd[1]: Starting LSB: start and stop MySQL...
-- Subject: Unit mysql.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has begun starting up.
 7月 01 12:19:30 localhost.localdomain mysql[6869]: Starting MySQL. ERROR!
 7月 01 12:19:30 localhost.localdomain systemd[1]: mysql.service: control process exited, code=exited status=1
 7月 01 12:19:30 localhost.localdomain systemd[1]: Failed to start LSB: start and stop MySQL.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has failed.
-- 
-- The result is failed.
 7月 01 12:19:30 localhost.localdomain systemd[1]: Unit mysql.service entered failed state.
-- Logs begin at 水 2015-07-01 01:58:42 JST, end at 水 2015-07-01 12:20:01 JST. --
 7月 01 12:17:12 localhost.localdomain avahi-daemon[597]: Withdrawing address record for fe80::a00:27ff:fe51:68d4
 7月 01 12:19:29 localhost.localdomain systemd[1]: Starting LSB: start and stop MySQL...
-- Subject: Unit mysql.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has begun starting up.
 7月 01 12:19:30 localhost.localdomain mysql[6869]: Starting MySQL. ERROR!
 7月 01 12:19:30 localhost.localdomain systemd[1]: mysql.service: control process exited, code=exited status=1
 7月 01 12:19:30 localhost.localdomain systemd[1]: Failed to start LSB: start and stop MySQL.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has failed.
-- 
-- The result is failed.
 7月 01 12:19:30 localhost.localdomain systemd[1]: Unit mysql.service entered failed state.
 7月 01 12:20:01 localhost.localdomain systemd[1]: Created slice user-0.slice.
-- Subject: Unit user-0.slice has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user-0.slice has finished starting up.
-- 
-- The start-up result is done.
 7月 01 12:20:01 localhost.localdomain systemd[1]: Starting Session 10 of user root.
-- Subject: Unit session-10.scope has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-10.scope has begun starting up.
 7月 01 12:20:01 localhost.localdomain systemd[1]: Started Session 10 of user root.
-- Subject: Unit session-10.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-10.scope has finished starting up.
-- 
-- The start-up result is done.
 7月 01 12:20:01 localhost.localdomain CROND[6983]: (root) CMD (/usr/lib64/sa/sa1 1 1)

でした。情報が少ないので苦戦しています。


# mysqladmin ping
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

/var/lib/mysql/ホスト名.err ファイルに何かエラーの原因が記録されているかもしれません。

また、mysql-libs は CentOS 7.1 にはありません。mariadb-libs (5.5.41) でしょうか?
mysql.com など別のリポジトリのものでしょうか?
CentOS 7.1 の mariadb-libs であれば、MariaDB-shared がインストールされるときに置き換わるので、手動でアンインストールする必要はないはず。

 # cat localhost.localdomain.err
150703 09:46:47 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150703  9:46:47 [Note] /usr/sbin/mysqld (mysqld 10.0.20-MariaDB) starting as process 8775 ...
150703  9:46:47 [Note] InnoDB: Using mutexes to ref count buffer pool pages
150703  9:46:47 [Note] InnoDB: The InnoDB memory heap is disabled
150703  9:46:47 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
150703  9:46:47 [Note] InnoDB: Memory barrier is not used
150703  9:46:47 [Note] InnoDB: Compressed tables use zlib 1.2.7
150703  9:46:47 [Note] InnoDB: Using Linux native AIO
150703  9:46:47 [Note] InnoDB: Not using CPU crc32 instructions
150703  9:46:47 [Note] InnoDB: Initializing buffer pool, size = 128.0M
150703  9:46:47 [Note] InnoDB: Completed initialization of buffer pool
150703  9:46:47 [ERROR] InnoDB: ./ibdata1 can't be opened in read-write mode
150703  9:46:47 [ERROR] InnoDB: The system tablespace must be writable!
150703  9:46:47 [ERROR] Plugin 'InnoDB' init function returned error.
150703  9:46:47 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150703  9:46:47 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
150703  9:46:47 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
150703  9:46:47 [ERROR] Plugin 'Aria' init function returned error.
150703  9:46:47 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
150703  9:46:47 [Note] Plugin 'FEEDBACK' is disabled.
150703  9:46:47 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
150703  9:46:47 [ERROR] Unknown/unsupported storage engine: InnoDB
150703  9:46:47 [ERROR] Aborting

150703  9:46:47 [Note] /usr/sbin/mysqld: Shutdown complete

150703 09:46:47 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended

./ibdata1の書き込みができないっぽいので所有者/所有グループを変えてみました。

# cd /var/lib/mysql
# ls -l
合計 110644
-rw-rw----. 1 root  root    16384  7月  1 11:44 aria_log.00000001
-rw-rw----. 1 root  root       52  7月  1 11:44 aria_log_control
-rw-rw----. 1 root  root 50331648  7月  1 11:44 ib_logfile0
-rw-rw----. 1 root  root 50331648  7月  1 11:44 ib_logfile1
-rw-rw----. 1 root  root 12582912  7月  1 11:44 ibdata1
-rw-r-----. 1 mysql root    22584  7月  3 09:46 localhost.localdomain.err
drwx------. 2 root  root     4096  7月  1 11:44 mysql
drwx------. 2 root  root     4096  7月  1 11:44 performance_schema
drwx------. 2 root  root        6  7月  1 11:44 test

# cd ../
# chown mysql:mysql mysql -R

これでsystemctl start mysqlを実行したところ、うまくいきました!

# systemctl start mysql
# systemctl status mysql
mysql.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/rc.d/init.d/mysql)
   Active: active (running) since 金 2015-07-03 09:50:42 JST; 12s ago
  Process: 20024 ExecStart=/etc/rc.d/init.d/mysql start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/mysql.service
           ├─20029 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/...
           └─20102 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-...

 7月 03 09:50:40 localhost.localdomain systemd[1]: Starting LSB: start and stop MyS....
 7月 03 09:50:42 localhost.localdomain mysql[20024]: Starting MySQL. SUCCESS!
 7月 03 09:50:42 localhost.localdomain systemd[1]: Started LSB: start and stop MySQL.
Hint: Some lines were ellipsized, use -l to show in full.

mariaDBの起動後はmysql.sockができました

# ls -l
合計 110648
-rw-rw----. 1 mysql mysql    16384  7月  1 11:44 aria_log.00000001
-rw-rw----. 1 mysql mysql       52  7月  1 11:44 aria_log_control
-rw-rw----. 1 mysql mysql 50331648  7月  3 09:50 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648  7月  1 11:44 ib_logfile1
-rw-rw----. 1 mysql mysql 12582912  7月  3 09:50 ibdata1
-rw-r-----. 1 mysql mysql    24010  7月  3 09:50 localhost.localdomain.err
-rw-rw----. 1 mysql mysql        6  7月  3 09:50 localhost.localdomain.pid
-rw-rw----. 1 mysql mysql        0  7月  3 09:50 multi-master.info
drwx------. 2 mysql mysql     4096  7月  1 11:44 mysql
srwxrwxrwx. 1 mysql mysql        0  7月  3 09:50 mysql.sock
drwx------. 2 mysql mysql     4096  7月  1 11:44 performance_schema
drwx------. 2 mysql mysql        6  7月  1 11:44 test

起動の確認

# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.0.20-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql-libsはmysql.comのものです。
mariaDBをインストールする前にやったことを簡単にご説明いたしますと、以前MySQLをインストールしました。しかし起動にerror: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")'とのエラーが出て、解決できずに放置しておりました。それでとりあえずmariaDBに移行してみようと思ったのです。ちなみにこのCentOS7.1はVirtualBoxで動かしてるものです。