Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu something (11 I think - upgrading to 12 soon)
Posts: 17
Rep:
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)
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 01:55 PM.
Reason: Spelling
Distribution: Ubuntu something (11 I think - upgrading to 12 soon)
Posts: 17
Original Poster
Rep:
Quote:
Originally Posted by pingu
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.
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.
Distribution: Ubuntu something (11 I think - upgrading to 12 soon)
Posts: 17
Original Poster
Rep:
Quote:
Originally Posted by pingu
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:
"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?
Distribution: Ubuntu something (11 I think - upgrading to 12 soon)
Posts: 17
Original Poster
Rep:
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)
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?
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)
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).
Distribution: Ubuntu something (11 I think - upgrading to 12 soon)
Posts: 17
Original Poster
Rep:
Quote:
Originally Posted by pingu
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
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
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.