LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 09-29-2012, 01:35 PM   #1
lenka
LQ Newbie
 
Registered: Sep 2012
Location: Denmark
Distribution: Ubuntu something (11 I think - upgrading to 12 soon)
Posts: 17

Rep: Reputation: Disabled
Cannot start MySQL server


I was trying to install Zend Guard Loader and made some errors so had to reinstall php (see this thread).

Now I have installed php and it's working with apache but I cannot start my MySQL server. It's installed and up to date, but when I try to start or run mysql I get the following error messages:

Code:
/var/run$ mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Code:
/var/run$ start mysql
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.6" (uid=1000 pid=14759 comm="start mysql ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
Code:
/var/run$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
There is nothing in my /var/log/mysql/error.log from when I try to do this.

I don't have any /var/run/mysqld/ folder - should I have?

ANy idea where I can check for error messages or how to fix the problem? Should I reintstall mysql?

Last edited by lenka; 09-29-2012 at 03:21 PM.
 
Old 09-29-2012, 02:54 PM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,298

Rep: Reputation: 123Reputation: 123
First guess is you're using wrong command.
To me it looks like you're trying to start a mysql client, to start the server it should be something like "service mysql.server start" or "/etc/init.d/mysql.server start".
You're on Ubuntu which uses "Upstart", I never used it but maybe try "mysql.server start"

Last edited by pingu; 09-29-2012 at 02:55 PM. Reason: Spelling
 
Old 09-29-2012, 03:30 PM   #3
lenka
LQ Newbie
 
Registered: Sep 2012
Location: Denmark
Distribution: Ubuntu something (11 I think - upgrading to 12 soon)
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pingu View Post
First guess is you're using wrong command.
To me it looks like you're trying to start a mysql client, to start the server it should be something like "service mysql.server start" or "/etc/init.d/mysql.server start".
You're on Ubuntu which uses "Upstart", I never used it but maybe try "mysql.server start"
No, sorry, this above command doesn't exist, and I have tried sudo mysql start and sudo start mysql and sudo /etc/init.d/mysql start

But it seems like I am missing the /var/run/mysqld folder including the mysqld.sock

Question is whether I should reinstall mysql or can it be fixed somehow.
 
Old 09-29-2012, 03:48 PM   #4
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,298

Rep: Reputation: 123Reputation: 123
mysql is the *client*, you need to start the *server*.
Look at it:
Code:
/var/run$ mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server
As I read this, mysql client can't connect to mysql server.
So, you need to find the correct command to start the server.
Unfortunately I don't have any Ubuntu around so I can't check it further right now.
What mysql-related service do you find in /etc/init.d?

If your command actually should start the server then a few suggestions:
1) Check under which user the server is suppposed to run.
2) Check permissions to the mysql direcory - /var/lib/mysql?
3) Check /var/log/messages, with a bit of luck you get some more info there.

Last edited by pingu; 09-29-2012 at 04:03 PM.
 
Old 09-29-2012, 03:49 PM   #5
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,298

Rep: Reputation: 123Reputation: 123
... and YES it can be fixed!
Even though I don't know what causes the problem I'm very very sure it can be fixed.
 
Old 09-29-2012, 04:02 PM   #6
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,298

Rep: Reputation: 123Reputation: 123
And of course, check the disk-space!
 
Old 09-29-2012, 04:16 PM   #7
lenka
LQ Newbie
 
Registered: Sep 2012
Location: Denmark
Distribution: Ubuntu something (11 I think - upgrading to 12 soon)
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pingu View Post
mysql is the *client*, you need to start the *server*.
Look at it:
Code:
/var/run$ mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server
As I read this, mysql client can't connect to mysql server.
So, you need to find the correct command to start the server.
Unfortunately I don't have any Ubuntu around so I can't check it further right now.
What mysql-related service do you find in /etc/init.d?

If your command actually should start the server then a few suggestions:
1) Check under which user the server is suppposed to run.
2) Check permissions to the mysql direcory - /var/lib/mysql?
3) Check /var/log/messages, with a bit of luck you get some more info there.
Ahh ... I wasn't aware of the difference client/server. But when I google ubuntu and start mysql server, I get that it's the /etc/init.d/mysql that is the right command (or just mysql) - that is the way I have always started and stopped it as well.

I do have a mysql command in my /etc/init.d ... and that is the only mysql-related command.

I get this in my /var/log/messages - they are from the 25th - I think that was just before I tried to install zend and messed up:
Code:
tail /var/log/messages
Sep 25 09:18:56 rs202400 kernel: [81392.579942] type=1505 audit(1348557536.722:24):  operation="profile_replace" pid=23378 name="/usr/sbin/mysqld"
Sep 25 09:18:56 rs202400 kernel: [81392.662645] type=1505 audit(1348557536.812:25):  operation="profile_replace" pid=23434 name="/usr/sbin/named"
Sep 25 09:18:56 rs202400 kernel: [81392.674216] type=1505 audit(1348557536.822:26):  operation="profile_replace" pid=23433 name="/usr/sbin/mysqld"
Sep 25 09:18:56 rs202400 kernel: [81392.678629] type=1505 audit(1348557536.822:27):  operation="profile_replace" pid=23377 name="/sbin/dhclient"
Sep 25 09:18:56 rs202400 kernel: [81392.678791] type=1505 audit(1348557536.822:28):  operation="profile_replace" pid=23377 name="/usr/lib/NetworkManager/nm-dhcp-client.action"
Sep 25 09:18:56 rs202400 kernel: [81392.678869] type=1505 audit(1348557536.822:29):  operation="profile_replace" pid=23377 name="/usr/lib/connman/scripts/dhclient-script"
Sep 25 09:18:56 rs202400 kernel: [81392.797279] type=1505 audit(1348557536.942:30):  operation="profile_replace" pid=23432 name="/sbin/dhclient"
Sep 25 09:18:56 rs202400 kernel: [81392.797410] type=1505 audit(1348557536.942:31):  operation="profile_replace" pid=23432 name="/usr/lib/NetworkManager/nm-dhcp-client.action"
Sep 25 09:18:56 rs202400 kernel: [81392.797476] type=1505 audit(1348557536.942:32):  operation="profile_replace" pid=23432 name="/usr/lib/connman/scripts/dhclient-script"
Sep 25 09:19:40 rs202400 kernel: Kernel logging (proc) stopped.
 
Old 09-29-2012, 05:12 PM   #8
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,298

Rep: Reputation: 123Reputation: 123
"I do have a mysql command in my /etc/init.d ... and that is the only mysql-related command."
OK, I surrender on the first part- "start mysql" should start the server.

How about the other 3 things - user, permissions & disk-space?
 
Old 09-30-2012, 04:06 AM   #9
lenka
LQ Newbie
 
Registered: Sep 2012
Location: Denmark
Distribution: Ubuntu something (11 I think - upgrading to 12 soon)
Posts: 17

Original Poster
Rep: Reputation: Disabled
Disk space is not problem, it's a whole new server (I wanted to use it for testing - I have another one with same specs as my live server, but got tired of messing up the live server :-D)

Code:
df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       854G   20G  791G   3% /
udev            7.9G  4.0K  7.9G   1% /dev
tmpfs           3.2G  232K  3.2G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            7.9G     0  7.9G   0% /run/shm
none            4.0T     0  4.0T   0% /media/psf
Premissions for /var/lib/mysql:
Code:
drwx------ 6 mysql   mysql   4096 Sep 30 10:00 mysql
Should be OK, right? (I am am wondering about the date though? Isn't it the date for last change? It's the current date/time everytime I check, even though I am not using mysql right now).

User - how to check that? I have access to root server and have just one user (my own) besides that atm.

I still thing it's fishy that I don't have any mysqld.sock file - nor a /var/run/mysqld folder. I am thinking that maybe the zend instalattion could have removed it somehow?
 
Old 09-30-2012, 04:25 AM   #10
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,298

Rep: Reputation: 123Reputation: 123
The /var/run/mysqld folder and the files below it are created when the mysql server starts.
The files are deleted when mysql stops, but the directory is not, AFAIK. However, if the directory doesn't exist it is simply created by the mysql startup process (tested on my Debian Lenny).

Check your /etc/mysql/my.cnf, the user for mysql is specified there as well as other settings.

On my 'puter, the databases are in /usr/local/share/mysql/ not in /var/lib/mysql - but that might be configured manually.
Anyway, check that /var/lib/mysql/ contains the databases.

Do you have any mysql-logs under /var/log?
The place for logging might be in my.cnf (grep log /etc/mysql/my.cnf)
 
1 members found this post helpful.
Old 09-30-2012, 04:39 AM   #11
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,298

Rep: Reputation: 123Reputation: 123
I see now you mentioned /var/log/mysql/error.log in your first post.
No other logfiles there?

One thing I remember happened to me some time ago:
mysql couldn't start (don't remember error message), I deleted the "ib_logfile#" in mysql database directory, then mysql started.

Also I read on some forums that you could try start the daemon directly to get more info what's going on.
#/usr/bin/mysqld
(well, normally it's in /usr/bin, you shouldn't need the path though).
 
1 members found this post helpful.
Old 09-30-2012, 05:15 AM   #12
lenka
LQ Newbie
 
Registered: Sep 2012
Location: Denmark
Distribution: Ubuntu something (11 I think - upgrading to 12 soon)
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pingu View Post
The /var/run/mysqld folder and the files below it are created when the mysql server starts.
The files are deleted when mysql stops, but the directory is not, AFAIK. However, if the directory doesn't exist it is simply created by the mysql startup process (tested on my Debian Lenny).
Ah, I see. That makes sense.

Quote:
Originally Posted by pingu View Post
Check your /etc/mysql/my.cnf, the user for mysql is specified there as well as other settings.
User is set to mysql

Quote:
Originally Posted by pingu View Post
On my 'puter, the databases are in /usr/local/share/mysql/ not in /var/lib/mysql - but that might be configured manually.
Anyway, check that /var/lib/mysql/ contains the databases.

Do you have any mysql-logs under /var/log?
The place for logging might be in my.cnf (grep log /etc/mysql/my.cnf)
Ahaaaa!!! It's now up and running! I had bad premissions in one of my databases which I just copied recently. I changed the premissions and suddently mysql was up and running by it self! Could it be that it has been trying to connect all along automatically?

Anyway - problem is solved. Thank you so much for your patience and your help!

Last edited by lenka; 09-30-2012 at 05:16 AM.
 
  


Reply

Tags
mysql


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to start mysql server & apache server at startup and then tomcat at last at boot sanjay87 Linux - Server 5 06-16-2012 09:19 AM
After moving mysql db to NFS[netapp] unable to start mysql server throws error naveenrajn Linux - General 3 09-13-2010 03:20 AM
I have RHEL 5.0 and MySQL start problem, my MySQL server doesn't start rsatya Linux - Enterprise 4 02-03-2009 01:04 PM
can't start mysql server vito_huang Linux - Server 1 03-10-2007 08:36 AM
Trying to start Mysql server number11 Linux - Newbie 3 06-06-2005 02:59 PM


All times are GMT -5. The time now is 07:44 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration