Reputation: 405
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
Upvotes: 19
Views: 123120
Reputation: 1
This issue happened with me but when I check the df -h it was 100% after delete some of file it's working normally .
Upvotes: -1
Reputation: 1799
what helped me was to add the following lines to /etc/my.cnf
innodb_force_recovery=4
and then sudo service mysqld start
worked like charm
Upvotes: 0
Reputation: 101
/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables & mysql_upgrade
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
Upvotes: 6
Reputation: 63
/etc/init.d/mysql stop
chown -R mysql:mysql /var/lib/mysql
mysql_install_db
/etc/init.d/mysql start
All this rescued my MySQL server!
Upvotes: 2
Reputation: 7157
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
Upvotes: 2
Reputation: 84
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
Upvotes: 1
Reputation: 1
RE: MySQL Daemon Failed to Start - centos 6 / RHEL 6
/etc/init.d/mysqld start MySQL Daemon failed to start. Starting mysqld: [FAILED]
Review The log: /var/log/mysqld.log
Solution that works for me is running this:
Please let me know if this won't solve your issue.
Upvotes: 0
Reputation: 435
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
Upvotes: 0
Reputation: 2444
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
Upvotes: 6
Reputation: 326
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
Upvotes: 1
Reputation: 41
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.
Upvotes: 1
Reputation: 1
It may be a permission issue,
Please try the following command /etc/init.d/mysqld start
as root user.
Upvotes: 0
Reputation: 1742
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
Upvotes: 1
Reputation: 38645
The most likely cause for this error is that your mysql server is not running. When you type in mysql
you are executing mysql client.
Try:
# sudo service mysql start
# mysql
Update (after OP included log in the question; taken from the comments below):
Thanks, saw your log. The log is saying the mysql user doesn't have proper access rights. I'm assuming your mysql user is mysql(this can be verified in
/etc/my.cnf
, execute
chown -R mysql:mysql /var/lib/mysql
and try starting
mysqld
again.
Upvotes: 19
Reputation: 815
Yet another tip that worked for me. Run the command:
$ mysql_install_db
Upvotes: 3
Reputation: 1
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.
Upvotes: 0