LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-29-2012, 01:12 PM   #1
DKLeader
LQ Newbie
 
Registered: Jun 2009
Location: Ishoej - Outside Copenhagen, Denmark
Distribution: Debian Lenny and Squeeze
Posts: 17

Rep: Reputation: 0
Debian Lenny - mysql - mysqld.sock issue


Hi,


I did a restart of one of my servers running on Debian Lenny and mysql service did not come online again.

When I type "/etc/init.d/mysql start" it simply fails.
The mysql.err log is empty and from the syslog nothing usefull there.


Noticed that mysqld.sock was missing and tried :

Code:
touch /var/run/mysqld/mysqld.sock
chown -R mysql /var/run/mysqld/
Did a dir and the file was there. Tried a mysql start and again it failed. Checked for the file mysqld.sock and it was gone again.

I have tried apt-get update and apt-get upgrade.

From uname -a :
Linux MainServer 2.6.26-2-686-bigmem #1 SMP Sun Mar 4 23:05:22 UTC 2012 i686 GNU/Linux

My my.cnf looks like this :
Code:
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
language        = /usr/share/mysql/english
# skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 92.62.196.70
#
# * Fine Tuning
#
key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 128K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover          = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log            = /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
#log_slow_queries       = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size         = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name
#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
skip-bdb
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet      = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer              = 16M

#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1


#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
Anyone got something I can check or test?
The server is part of a running system and is needed back online

Best Regards
Jakob
 
Old 06-29-2012, 02:14 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Under the "[mysqld]" header add the following:

Code:
log-error=/var/log/mysql/error.log
Attempt to start it and see if it reports anything to that log file.

---------- Post added 06-29-12 at 12:15 PM ----------

Oh and make sure you are running the start command as root or via sudo.
 
Old 06-29-2012, 03:03 PM   #3
DKLeader
LQ Newbie
 
Registered: Jun 2009
Location: Ishoej - Outside Copenhagen, Denmark
Distribution: Debian Lenny and Squeeze
Posts: 17

Original Poster
Rep: Reputation: 0
Nope - it didn't even create the log file when I tried to start mysql.

Quote:
Originally Posted by Kustom42 View Post
Under the "[mysqld]" header add the following:

Code:
log-error=/var/log/mysql/error.log
Attempt to start it and see if it reports anything to that log file.

---------- Post added 06-29-12 at 12:15 PM ----------

Oh and make sure you are running the start command as root or via sudo.
 
Old 06-29-2012, 03:06 PM   #4
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
And you are running the command as sudo? What happens if you check the status with mysqladmin or try and start mysqld in safe mode?

Code:
sudo mysqladmin -uroot -p status
Code:
sudo mysqld_safe &
 
Old 06-29-2012, 03:47 PM   #5
DKLeader
LQ Newbie
 
Registered: Jun 2009
Location: Ishoej - Outside Copenhagen, Denmark
Distribution: Debian Lenny and Squeeze
Posts: 17

Original Poster
Rep: Reputation: 0
On the first I get :
Code:
MainServer:~# sudo mysqladmin -uroot -p status
sudo: unable to resolve host MainServer
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
On the second I get :
Code:
MainServer:~# sudo: unable to resolve host MainServer
nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[7809]: started
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[7818]: ended
I don't understand why it comes with a resolve problem since nothing has been changed and it has been working.

Quote:
Originally Posted by Kustom42 View Post
And you are running the command as sudo? What happens if you check the status with mysqladmin or try and start mysqld in safe mode?

Code:
sudo mysqladmin -uroot -p status
Code:
sudo mysqld_safe &
 
Old 06-29-2012, 03:51 PM   #6
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
This sounds like a sudo problem.

Looks like your on an ubunutu flavor so the only way I know of is to boot into the grub rescue mode which allows you to gain root access. You can then edit your /etc/hosts file so that the host "MainServer" resolves to your servers loopback interface.

Check out this posting that gives some more info with an example:

http://askubuntu.com/questions/59458...olve-host-none
 
Old 06-29-2012, 03:55 PM   #7
DKLeader
LQ Newbie
 
Registered: Jun 2009
Location: Ishoej - Outside Copenhagen, Denmark
Distribution: Debian Lenny and Squeeze
Posts: 17

Original Poster
Rep: Reputation: 0
I have solved the resolve issue by editing hosts, but still have the same start problem on mysql.
I find it strange as there was no problem before I did a restart of the server.
It is a Debian Lenny 5.

Code:
MainServer:~# sudo true
MainServer:~#
Quote:
Originally Posted by Kustom42 View Post
This sounds like a sudo problem.

Looks like your on an ubunutu flavor so the only way I know of is to boot into the grub rescue mode which allows you to gain root access. You can then edit your /etc/hosts file so that the host "MainServer" resolves to your servers loopback interface.

Check out this posting that gives some more info with an example:

http://askubuntu.com/questions/59458...olve-host-none

Last edited by DKLeader; 06-29-2012 at 03:56 PM. Reason: Added info on sudo
 
Old 06-29-2012, 04:27 PM   #8
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Ok so now that you have resolved your sudo problem, what happens when you try to start mysql via sudo?

Are there any errors reported to stderr(your terminal) or is there anything in the mysql log or error log file?

Are you able to start it in safe mode via mysqld_safe?
 
Old 06-30-2012, 10:52 AM   #9
DKLeader
LQ Newbie
 
Registered: Jun 2009
Location: Ishoej - Outside Copenhagen, Denmark
Distribution: Debian Lenny and Squeeze
Posts: 17

Original Poster
Rep: Reputation: 0
When I try the first part again I get :
Code:
MainServer:~# sudo mysqladmin -uroot -p status
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
MainServer:~#
And from second one I get :
Code:
MainServer:~# sudo mysqld_safe &
[1] 26658
MainServer:~# nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[26692]: started
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[26701]: ended
It seems to "lock" itself until I press Ctrl-C at this point. It returns this
Code:
[1]+  Done                    sudo mysqld_safe
MainServer:~#
when I press Ctrl-C

Quote:
Originally Posted by Kustom42 View Post
Ok so now that you have resolved your sudo problem, what happens when you try to start mysql via sudo?

Are there any errors reported to stderr(your terminal) or is there anything in the mysql log or error log file?

Are you able to start it in safe mode via mysqld_safe?
 
Old 07-01-2012, 01:19 PM   #10
DKLeader
LQ Newbie
 
Registered: Jun 2009
Location: Ishoej - Outside Copenhagen, Denmark
Distribution: Debian Lenny and Squeeze
Posts: 17

Original Poster
Rep: Reputation: 0
[solved]

Found this
Code:
InnoDB: Operating system error number 13 in a file operation. 

You might come across with following error while starting mysql.
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.071027 07:43:13  mysqld ended

Resolution: This error may mean mysql does not have privilege to access database directory. (/var/lib/mysql) 

Giving the required privilege will fix this error. 
 ----------------- 
chown -R mysql.mysql /var/lib/mysql
 
-----------------
in a post on another support page.
Did a chown as suggested and solved my problem.

Reason I found this solution was that I did :
Code:
mysqld --skip-grant-tables --user=mysql
And got the error as mentioned in above. Did a google and found that solution.
 
Old 07-02-2012, 12:09 PM   #11
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Nice work. I'm really surprised that error didn't report on the mysqld_safe or in the mysql error log but you never know sometimes.

One other thing is you might want to comment out the "skip-dbd" line from you my.cnf as it is deprecated in 5.1 and will give you errors if you upgrade and try to start MySQL.
 
  


Reply

Tags
debian, lenny, mysql



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] MySQL Start Problem::::socket '/var/run/mysqld/mysqld.sock' (2) arun-linux Linux - Software 6 11-29-2012 06:56 AM
[SOLVED] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' Burningmace Linux - Server 5 09-06-2012 01:29 AM
Can't connect to local MySql server through socket '/var/run/mysqld/mysqld.sock' (2) thoufiq Linux - Server 4 04-19-2011 04:35 AM
mysql needs mysqld.sock? radiodee1 Linux - Server 10 01-25-2007 05:33 AM
Mysql Installation on Gentoo - mysqld.sock? Bob Gaskin Linux - Software 1 12-04-2003 11:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration