3

I'm executing the following command in a shell script and I'm executing this on an RHEL-6 server and MySQL version 5.1.47-

mysqld_safe --defaults-extra-file=/custom/path/of/my.cnf

The path of my.cnf can be anything. (If I am not wrong, as a developer we cannot determine where mysql could be installed.) After the above command in the script, there are a few mysql commands to be executed. When the script executes the above command, the output console displays that the mysql service has successfully started. But when the control comes to the part where the mysql commands are to be executed, the following error message comes up-

mysqld dead but subsys locked

Any idea where I am going wrong?

This is what my my.cnf contains-

[mysqld]
innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_file_io_threads=4
max_binlog_size=20M
max_allowed_packet=16M
max_connections=500
log_bin=logFile.log
binlog-do-db=test
server-id=1
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
binlog-format=ROW
log_warnings=1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
0
1

For me, this means that the daemon has crashed and was restarted, but the lockfile that mysqld uses to prevent multiple daemons from accessing the same database is still there...

I fix it with

service mysqld stop
service mysqld start

Not sure if you can just to a restart instead of a stop then start, and I haven't figured out the cause yet for the crash either.

0

After running mysqld_safe command, make sure your mysql server is started using 'ps -ef | grep mysql' command. You'd see two processes (mysqld & mysqld_safe) in the command output if mysql server is started.

  • If Server is not starting at all, add log_error=/custom/path/to/log/file in [mysqld] section in your my.cnf and paste the error log here to investigate the issue of mysql server
  • If server is starting but just issue regarding subsys or permissions or else,
    1. stop mysql service
    2. remove subsys file (usually : /var/lock/subsys/mysql)
    3. start mysql service and try to login to mysql server as follows : mysql -uroot -p your_root_pass

It would be helpful to anyone to identify the exact cause of service issue if you wouldn't mind pasting error logs.

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.