0

I have already installed MySQL in a Server (Centos 7) by the following commands:

yum install -y mysql
yum install -y mysql-server
yum install -y mysql-devel

After the installation, I type mysql and meet the error

ERROR 2002 (HY000): Can't connect to local MySQL server through socket 
'/var/mysql/mysql.sock' (2)

I think it is because I didn't started the MySQL service yet, so I type the command

service mysqld start

Then I get the message said that Job for mariadb.service failed

Here is the content of /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0

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

However, the file /var/lib/mysql/mysql.sock is not existed in my server. BTW, SELINUX is disabled manually.

mariadb.log shows

InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
InnoDB: Possible causes for this error:
   (a) Incorrect log file is used or log file size is changed
   (b) In case default size is used this log file is from 10.0
   (c) Log file is corrupted or there was not enough disk space
   In case (b) you need to set innodb_log_file_size = 48M
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGIN failed.
[ERROR] Unknown/unsupported storage engine: innodb
[ERROR] Aborting
  • 2
    stopdisablingselinux.com There is no need to disable SELinux. Certainly straight out of the box, services installed from official repos and no exotic config services will work the way you expect with SELinux enabled. Please add the errors reported in /var/log/mariadb/mariadb.log to your question. The mysql.sock will be created when Mysql is started. Is this a clean install or did you have a MySQL DB before this on this system? – Bram Nov 6 '15 at 11:51
  • Thanks for your remind and I attached some messages of mariadb.log. It is a clean system with MySQL installed for the first time. – foool Nov 6 '15 at 12:34
  • So? Did you check disk space? Size of the file and the contents of the conf file? – Bram Nov 6 '15 at 12:38
1

I fixed this problem, so I want to answer it myself. If this self-answering behavior is not appropriate, please make comments below.

Overall, I solve this problem by figuring issues listed in /var/log/mariadb/maridb.log file.

First, I remove the ./ib_logfile0, which is pointed out beyond size limitation in the log file. Then, I try to enable + start mariadb with systemctl, fail again. maridb.log says Incorrect information in file './mysql/proxies_priv.frm'. By backuping the incorrect file and restarting the mysql, the maridb is finally OK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.