0

I want to edit the /etc/my.cnf file.

I've tried to use this as the file content:

[mysqld]
set-variable = max_allowed_packet=24M
set-variable = max_connections=300
log-slow-queries
safe-show-database
local-infile=0
open_files_limit=3980 

then, I've tried to restart the mysql server:

/etc/rc.d/init.d/mysql restart

but it failed with the following error:

root@server1 [~]# /etc/rc.d/init.d/mysql restart
Shutting down MySQL.... [ OK ]
Starting MySQL...The server quit without updating PID file (/var/lib/mysql server1.domain.com.pid). [FAILED]

I've read here that I need to replace [mysqld] with [mysql], but he is using Percona, and I am just using a standart whm/cpanel installation, will it work too?

dawud
  • 15,096
  • 3
  • 42
  • 61
Earl
  • 7
  • 1
  • 1
  • 1
  • 2
    You need to read the error log and find out what's preventing MySQL from starting. – dawud Jun 21 '14 at 10:55
  • 1
    http://dev.mysql.com/doc/refman/5.5/en/error-log.html – ADM Jun 21 '14 at 11:07
  • 2
    FWIW, I'm not aware that `set-variable = max_allowed_packet=24M` is valid `my.cnf` syntax. You set variables by just putting the `name=value` pair in there. – Felix Frank Jun 21 '14 at 11:07
  • ah so this is the right syntax, previously is for old mysql syntax [mysqld] max_allowed_packet=24M max_connections=300 log-slow-queries local-infile=0 open_files_limit=3980 btw if i add safe-show-database, got FAILED message too, is it already changed too? – Earl Jun 21 '14 at 21:44
  • I know this is quite old, but doesn't the error log location depend on the settings in my.cnf? If my.cnf fails to load, then there will be no error log. – Spero Aug 21 '17 at 12:03

1 Answers1

2

First of all check mysql logs and error logs to see whats going on with mysql service,if you see no error logs than you can deploy these steps.

Check if there is any running MySQL process

ps aux | grep mysql

If you are able to see any mysql process like below, just kill that process.

kill -9 pid

Make sure that there is no mysql process running at this point. Restart MySQL.

OR

Try moving the mysql config file /etc/my.cnf file and restart mysql.

mv /etc/my.cnf /etc/my.cnf.backup

Restart mysql.

OR

Try to move the log file named ib_logfile in /var/lib/mysql and restart mysql. Sometimes mysql will fail because it face difficulty updating the log file.

mv /var/lib/mysql/ib_logfile* /root/

Restart and see the results.

service mysqld restart

You can also remove ib_logfile as it will be created automatically after mysql restart.

Innovator
  • 507
  • 2
  • 11