[php] MySQL Daemon Failed to Start - centos 6

EDIT: Look at the checkmarked answer comments to get your issue solved.

Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following:

service mysqld start

Also

When I type: mysql

I get:

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

I know that there should be a mysql.sock file in that directory, so I create one. But the file just auto removes its self and I continue to get the error 2002.

I am also unable to log into PHPMyAdmin due to the error. I can access phpmyadmin page but when logging in I get: #2002 Cannot log in to the MySQL server

EDIT:

Here is my mysql.log file:

131201 13:05:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
131201 13:18:18 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
131201 13:18:18 [Note] Plugin 'FEDERATED' is disabled.
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
131201 13:18:18 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
131201 13:18:18 InnoDB: The InnoDB memory heap is disabled
131201 13:18:18 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131201 13:18:18 InnoDB: Compressed tables use zlib 1.2.3
131201 13:18:18 InnoDB: Using Linux native AIO
131201 13:18:18 InnoDB: Initializing buffer pool, size = 128.0M
131201 13:18:18 InnoDB: Completed initialization of buffer pool
131201 13:18:18  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
131201 13:18:18 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

I ran mysql_upgrade and got

Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
FATAL ERROR: Upgrade failed

This question is related to php mysql phpmyadmin centos6

The answer is


try

netstat -a -t -n | grep 3306 

to see any one listening to the 3306 port then kill it

I was having this problem for 2 days. Trying out the solutions posted on forums I accidentally ran into a situation where my log was getting this error

check that you do not already have another mysqld process


It may be a permission issue,

Please try the following command /etc/init.d/mysqld start as root user.


run this :

chown -R mysql:mysql /var/lib/mysql

and try again!


Yet another tip that worked for me. Run the command:

$ mysql_install_db

You may need free up some space from root (/) partition. Stop mysql process by:

/etc/init.d/mysql stop

Delete an unused database from mySql by command:

rm -rf [Database-Directory]

Execute it in /var/lib/mysql. Now if you run df -h, you may confused by still full space. For removing the unused database 's directory to be affected, you need to kill processes are using current directory/partition.

Stopping mysql_safe or mysqld_safe and then mysqld:

ps -A

Then find mysql's process number (e.g. 2234). Then execute:

kill 2234

Now start again mysql:

/etc/init.d/mysql start

 /etc/init.d/mysqld stop

 mysqld_safe --skip-grant-tables & mysql_upgrade

 /etc/init.d/mysqld stop

 /etc/init.d/mysqld start

Reference here 2.10.2.1 Troubleshooting Problems Starting the MySQL Server.

1.Find the data directory ,it was configured in my.cnf.

[mysqld]
datadir=/var/lib/mysql

2. Check the err file,it log the error message about why mysql server start failed. the name of err file is related with your hostname.

cd /var/lib/mysql
ll
tail (hostname).err

3.If you find some messages like :

InnoDB: Error: log file ./ib_logfile0 is of different size 0 33554432 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
170513 14:25:22 [ERROR] Plugin 'InnoDB' init function returned error.
170513 14:25:22 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
170513 14:25:22 [ERROR] Unknown/unsupported storage engine: InnoDB
170513 14:25:22 [ERROR] Aborting

then

delete ib_logfile0 and ib_logfile1

, then,

/etc/init.d/mysqld start

For those who will be here in the future, if all above methods are not working, check the my.cnf file by:

$ sudo gedit /etc/my.cnf

Find the line start with:

bind-address=[an-IP-address]

Check if the IP address after the equal sign is correct. If you don't even know what the IP is, just use localhost, then you can only connect to MySQL inside the same host.

If you want to connect to MySQL remotely, you should actually comment out that line entirely, then it will listen on all IPs and ports which you need because you will be connecting remotely to it over public IPv4.

After that add a user to access your database such as:

mysql> GRANT ALL ON database_name.* TO [email protected] IDENTIFIED BY 'your_password';

Replace xx.xx.xx.xx with your local IP address of your laptop/desktop or if it is dynamic you can add them either by: '192.168.0.%' as a dynamic C-class or '%' if you want to be able to connect from anywhere (this is less secure)

Also, if there's a firewall installed, one should open the port on the firewall;

For example in Ubuntu:

sudo ufw allow 3306/tcp
sudo service ufw restart

Now, check if the service is startable by:

$ sudo service mysqld start

I had the same issue happening. When I checked the error.log I found that my disk was full.

Use:

df -h 

on the command line. it will tell you how much space you have left. mine was full. found my error.log file was 4.77GB. I downloaded it and then deleted it. Then I used service mysqld start and it worked.


I just had this error. I could not connect remotely to my mysql server. I tried restarting mysql server with service mysqld restart (I used root). It stopped but did not start again. Turns out my memory was full. Cleared out a few GBs and it is working fine.


  1. /etc/init.d/mysql stop
  2. chown -R mysql:mysql /var/lib/mysql
  3. mysql_install_db
  4. /etc/init.d/mysql start

All this rescued my MySQL server!


Try restarting apache sudo service httpd restart. Worked for me.


Your database was shut down because of insufficient memory! You can edit the file my.cnf base below graph to resolve it

performance_schema_max_table_instances=200
table_definition_cache=200
table_open_cache=128

RE: MySQL Daemon Failed to Start - centos 6 / RHEL 6

  1. Yum Install MySQL
  2. /etc/init.d/mysqld start MySQL Daemon failed to start. Starting mysqld: [FAILED]

  3. Review The log: /var/log/mysqld.log

  4. You might get this error: [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

Solution that works for me is running this:

  1. $ mysql_install_db

Please let me know if this won't solve your issue.


If you are using yum in AIM Linux Amazon EC2. For security, make a backup complete of directory /var/lib/mysql

sudo yum reinstall -y mysql55-server

sudo service mysqld start

Examples related to php

I am receiving warning in Facebook Application using PHP SDK Pass PDO prepared statement to variables Parse error: syntax error, unexpected [ Preg_match backtrack error Removing "http://" from a string How do I hide the PHP explode delimiter from submitted form results? Problems with installation of Google App Engine SDK for php in OS X Laravel 4 with Sentry 2 add user to a group on Registration php & mysql query not echoing in html with tags? How do I show a message in the foreach loop?

Examples related to mysql

Implement specialization in ER diagram How to post query parameters with Axios? PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver' phpMyAdmin - Error > Incorrect format parameter? Authentication plugin 'caching_sha2_password' is not supported How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Connection Java-MySql : Public Key Retrieval is not allowed How to grant all privileges to root user in MySQL 8.0 MySQL 8.0 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

Examples related to phpmyadmin

phpMyAdmin on MySQL 8.0 phpmyadmin - count(): Parameter must be an array or an object that implements Countable Error loading MySQLdb Module 'Did you install mysqlclient or MySQL-python?' phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO) phpMyAdmin access denied for user 'root'@'localhost' (using password: NO) mysqli_real_connect(): (HY000/2002): No such file or directory How to create a foreign key in phpmyadmin #1292 - Incorrect date value: '0000-00-00' MySQL error - #1932 - Table 'phpmyadmin.pma user config' doesn't exist in engine phpMyAdmin Error: The mbstring extension is missing. Please check your PHP configuration

Examples related to centos6

Upgrading PHP on CentOS 6.5 (Final) centos: Another MySQL daemon already running with the same unix socket MySQL Daemon Failed to Start - centos 6 Run bash script as daemon You don't have permission to access / on this server CentOS 64 bit bad ELF interpreter