LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Debian Lenny - mysql - mysqld.sock issue (http://www.linuxquestions.org/questions/linux-software-2/debian-lenny-mysql-mysqld-sock-issue-4175414045/)

DKLeader 06-29-2012 02:12 PM

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

Kustom42 06-29-2012 03:14 PM

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.

DKLeader 06-29-2012 04:03 PM

Nope - it didn't even create the log file when I tried to start mysql.

Quote:

Originally Posted by Kustom42 (Post 4715226)
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.


Kustom42 06-29-2012 04:06 PM

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 &

DKLeader 06-29-2012 04:47 PM

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 (Post 4715272)
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 &


Kustom42 06-29-2012 04:51 PM

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

DKLeader 06-29-2012 04:55 PM

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 (Post 4715312)
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


Kustom42 06-29-2012 05:27 PM

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?

DKLeader 06-30-2012 11:52 AM

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 (Post 4715333)
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?


DKLeader 07-01-2012 02:19 PM

[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.

Kustom42 07-02-2012 01:09 PM

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.


All times are GMT -5. The time now is 01:51 PM.