Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am not able to start MySQL , i am gettting this error

[root@server scripts]# service mysql start
Starting MySQL.The server quit without updating PID file (/[FAILED]mysql/server.mydomain.com.pid).

what should i do

I dont have any my.cnf file anywhere

only have these

/etc/pki/tls/openssl.cnf
/home/monty/.mylogin.cnf
/opt/rightscale/sandbox/openssl.cnf
/root/.mylogin.cnf
/usr/share/doc/MySQL-server-5.6.10/my-default.cnf
/usr/share/mysql/my-default.cnf
/var/lib/mysql/auto.cnf
share|improve this question
    
what error you are getting in mysql error log tail 100f /var/log/mysqld.log ? –  Abhishek Anand Amralkar Jul 17 '13 at 5:05

2 Answers 2

up vote 1 down vote accepted

In CentOS you need to copy /usr/share/doc/MySQL-server-5.6.10/my-default.cnf to /etc/my.cnf and you have to make changes in my.cnf as per your server configuration,after every changes in my.cnf to get reflect you need to restart you mysql server.

It seems you have issue with you permission on mysql datadir. Run below command

  mysql_install_db

This command will check your mysql configuration and find out the errors . Once this is done

  chown -R mysql:mysql /path to your mysql data dir ( default is /var/lib/mysql)

  service mysql restart
share|improve this answer
    
I had the error that my /tmp permission gets changed , i have made that 777 an dnow that worked. Can i still now do that mysql_install_db. because i think i am currently using default conf file –  MOtaro Site Jul 17 '13 at 5:52
    
if mysql is working for you and you are not in mood to play around it with than you can leave it. –  Abhishek Anand Amralkar Jul 17 '13 at 5:53
    
But i want to chnage the default config and want that so that mysql should write pid in different folder not in /tmp folder –  MOtaro Site Jul 17 '13 at 6:02
    
So copy /usr/share/doc/MySQL-server-5.6.10/my-default.cnf to /etc as my.cnf and define your own custom paramaters for mysql . –  Abhishek Anand Amralkar Jul 17 '13 at 6:14
    
i checked from here dev.mysql.com/doc/refman/5.6/en/server-default-changes.html but could not find pid_file parameter there. –  MOtaro Site Jul 17 '13 at 6:30

I had this same issue on CentOS 6. Abhishek Anand Amralkar has a good suggestion because the /etc/my.cnf installed by CentOS on my system (due to mysql-libs as an dependency package installed by anaconda) had the following:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

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

The pid-file parameter was referencing a directory and file that did not exist on my system and even if it did, the mysql:mysql user:group needs to be granted permissions to edit it.

So the bottom-line is make sure you know where your real my.cnf file is (cd / ; nice find . -name "my.cnf"), that it is the actual one that mysql is using when it runs, and that it has the correct configuration for the installation you created. I think a lot of CentOS users are getting tripped up by this default my.cnf in /etc.

A quick solution is to simply:

mv /etc/my.cnf /etc/my.cnf.old
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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