Portal Home > Knowledgebase > Articles Database > mysql not work
mysql not work
Posted by mbekhit, 09-16-2014, 08:35 AM |
MySql stopped and not work i tried to make restart but not work and give me this error
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql .sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' ex ists!
mysql has failed, please contact the sysadmin (result was "mysql is not running"
|
Posted by net, 09-16-2014, 08:52 AM |
Moved > Hosting Security and Technology.
|
Posted by eth00, 09-16-2014, 09:20 AM |
It looks like you are trying to connect to mysql, not start it. What do you get when you run:
service mysql start
or
service mysqld start
?
|
Posted by mbekhit, 09-16-2014, 09:24 AM |
root@host [~]# service mysqld start
mysqld: unrecognized service
root@host [~]# service mysql start
Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/host.arabnewtech.com.pid).
root@host [~]#
and this error log
2014-09-16 15:53:00 11971 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace arabnew4_ecommerce/okncz_jcomments_settings uses space ID: 1936 at filepath: ./arabnew4_ecommerce/okncz_jcomments_settings.ibd. Cannot open tablespace tenders2_ant_tenderseg-oldd/header_maintab which uses space ID: 1936 at filepath: ./tenders2_ant_tenderseg-oldd/header_maintab.ibd
2014-09-16 15:53:00 7ffaab52f720 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./tenders2_ant_tenderseg-oldd/header_maintab.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
140916 15:53:00 mysqld_safe mysqld from pid file /var/lib/mysql/host.arabnewtech.com.pid ended
|
Posted by eth00, 09-16-2014, 09:31 AM |
The error gives you three different things to check. Have you checked all three of them to see if that fixes it?
Also you may want to go back and redact the logs, the above post has your server hostname and a few DB names.
|
Posted by securedhost, 09-16-2014, 10:02 AM |
As i think any Innodb table may be corrupt. Firstly kill all mysql process through below command
killall -9 mysql
then try to start mysql again
service mysql start
But its not permanent solution, After restart monitor mysql log and remove table data which showing corrupt.
|
Posted by onzehost, 09-16-2014, 10:02 AM |
rm /var/lib/mysql/host.arabnewtech.com.pid
service mysql start
|
Posted by mbekhit, 09-16-2014, 10:54 AM |
I have find this forum thread helpful: http://forums.cpanel.net/f402/innodb...de-418722.html
the MySql work fine now
|
Posted by Srv24x7, 09-16-2014, 11:50 AM |
Hi,
If you have tried the steps mentioned on the link you gave, you should check the MySQL error logs too, as innoDB may have crashed for some DBs too. Please check this once. Also, start taking the DB backup separately to avoid any further crash situation.
|
Posted by mbekhit, 09-17-2014, 09:53 AM |
what do you mean "taking the DB backup separately" and how i can do that ? thank you
|
Posted by Srv24x7, 09-17-2014, 10:15 AM |
Hi,
You can take a help of a script to do a manual mysqldump of DB every week or so with error logs activated in it, so you always have a backup ready to have revert back the DB.
|
Posted by johnduper, 09-21-2014, 04:18 AM |
check the sock path in my.cnf file and see it is correct. restart then.
|
Posted by techbeo, 09-21-2014, 07:28 AM |
The logs indicates that mysql databases have got corrupted. Check on the mysql configuration for any mistakes and then try starting mysql in recovery mode. If the database corruption is not too complicated, mysql would recover your databases. But even if you have started in recovery mode and still corruption exists, then you might have to check on advanced ways of restoring it.
|
Posted by eap18, 09-21-2014, 08:30 PM |
if /etc/my.cnf is corrupt
remove file mysql config : rm -f /etc/my.cnf
and copy config templates in /usr/share/mysql/
have 3 choise :
my-small.cnf
my-medium.cnf
my-large.cnf
my-huge.cnf
copy my-medium.cnf to /etc/my.cnf
and restart service
|
Posted by Kailash12, 09-22-2014, 01:51 AM |
OP provided the logs which shows Innodb table was corrupted. This shouldn't be an issue of my.cnf file.
|
Add to Favourites Print this Article
Also Read