Mysql server cannot start in Centos

Asked

Viewed 2,588 times

2

I cannot perform any operation in Mysql as it gives error of:

Starting Mysqlcouldn’t find Mysql server

root@server2 [~]# /etc/init.d/mysql status
MySQL is not running, but lock file (/var/lock/subsys/mysql[FAILED]
root@server2 [~]# /etc/init.d/mysql restart
MySQL server PID file could not be found!                  [FAILED]
/etc/init.d/mysql: line 301: cd: /usr/local/mysql: No such file or directory
Starting MySQLCouldn't find MySQL server (/usr/local/mysql/[FAILED]ld_safe)
root@server2 [~]# /etc/init.d/mysql stop
MySQL server PID file could not be found!                  [FAILED]
root@server2 [~]# /etc/init.d/mysql start
/etc/init.d/mysql: line 301: cd: /usr/local/mysql: No such file or directory
Starting MySQLCouldn't find MySQL server (/usr/local/mysql/[FAILED]ld_safe)
root@server2 [~]# mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

Filing cabinet /etc/my.cnf:

root@server2 [~]# cat /etc/my.cnf
[mysqld]
user = mysql
basedir = /usr/local/mysql
skip-external-locking
key_buffer = 384M
max_allowed_packet=268435456
max_connections = 500
max_user_connections = 35
wait_timeout=40
connect_timeout=10
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
thread_concurrency = 8
server-id       = 1
skip-innodb

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

Searching some posts, I found that some program might be holding Mysql. Follow the command I checked:

root@server2 [~]# lsof | grep mysql
tailwatch 20718      root  mem       REG        3,5    206553    8922204 /usr/local/cpanel/3rdparty/perl/514/lib/perl5/cpanel_lib/i386-linux-64int/auto/DBD/mysql/mysql.so

And the command yum info mysql-server:

root@server2 [~]# yum info mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.com
 * extras: centos.chi.host-engine.com
 * updates: mirror.lug.udel.edu
Excluding Packages in global exclude list
Finished
Error: No matching Packages to list

Other information:

  • there is no Mysql process running.
  • Centos version 5.10 (Final).
  • It is a dedicated server maintained by hostdime. Since it was installed I only needed to change packages once, which was for the PHP update. And there was no problem. That’s almost 7 months.
  • There was never a need to update except for PHP (as I said, 7 months ago). Otherwise there was never need to update Mysql periodically.
  • It’s probably simple: the server Mysql is not running on the machine, so you cannot run the client mysql. Ever tried to give a service mysqld start before trying to use the mysql?

  • Notorious. But I can’t do anything. And I’m afraid because I have 2 huge bases and mysqldump doesn’t work.

  • service mysqld start - mysqld: unrecognized service

  • The server works normally for 2 years. Surely it had both services installed.

  • In any case, yum info mysql-server just to see. It would be nice if you gave more details of what you changed in the machine to stop it.

  • @Bacco updated the post with the exit

  • What version of Centos?

  • Centos release 5.10 (Final)

  • Very strange, because in 5.10 the package name is mysql-server. You’ve been working on the repositories?

  • So.. It’s a dedicated server maintained by hostdime. Since it was installed I only needed to change packages once, which was for the php update. And there was no problem. That’s almost 7 months.

  • I don’t know much where you’ll have to start there, because it’s really weird. Do you keep it up to date? The service worked and stopped fooling around?

  • There was never a need to update except for php. As I said, 7 months ago. Otherwise there was never need to update mysql periodically.

  • 1

    I think that in this case the first thing to do is to download the directories of the database and see if everything is ok, because it seems that the problem is more serious. And keeping the server up-to-date is good to prevent headaches with security risks. If the default installation was made, the way is /var/lib/mysql

  • Thanks @Bacco. I will take this backup to avoid data loss.

Show 10 more comments

1 answer

1

Your system seems to have crashed (not shut down in the correct way), and as a consequence, should not have deleted the mysql server lock file in a normal shutdown procedure.

Delete the lock file with the command below:

rm /var/lock/subsys/mysql

Turn the /etc/init.d/mysql status.

ps: I am using RHEL5, the lock file is slightly different: /var/lock/subsys/mysqld

Browser other questions tagged

You are not signed in. Login or sign up in order to post.