mysql

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket '/var/lib

service mysql start
Starting service MySQL warning: /var/lib/mysql/mysql.sock didn’t appear within 3

need help thanks

Have you ensured both mysqld and apache are running? YaST > System > System services (if I remember correctly) allows you to set both to start automatically on boot.

Apache and mysql are independent services, one can be run without the other. OP seems to have a problem starting mysql, I can’t tell from the info why. He probably should look in the log files in /var/log to see if there are any problems. He didn’t also say if this was a standard install from OpenSUSE packages or he tried to install a foreign package.

A search through info mysql reveals that:

The error (2002) `Can’t connect to …’ normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket filename or TCP/IP port number when trying to connect to the server.

This suggests the fault is in the installation. Do you install via YaST or some other way?

I’m running opensuse 11.0 and I install it with YaST

service mysql start
Starting service MySQL warning: /var/lib/mysql/mysql.sock didn’t appear within 30 seconds
done

that is what am getting when i start mysql

thanks

Have you tried starting it another way - such as changing the system services to enable it to start at login? You can press Esc after booting or look in /var/log/boot.msg to see if you get the same error message.

If you do, check whether there is a bug report for OpenSUSE 11 and, if not, add one with the error message from /var/log/boot.msg

not meaning to hijack this thread but I’ve been fussing with this same problem for 2 days now.

service mysql start
Starting service MySQL warning: /var/lib/mysql/mysql.sock didn’t appear within 3

I have OpenSUSE 10.3
I’ve installed MySQL via Yast
After installation, it seems to work fine. I’ve created a database and imported some tables into it from MS Access. I can connect to the database from a networked PC using MySQL Administrator as well as Navicat. I wanted to test out replication. Part of that process I did the above (service mysql restart) and that’s where the error happens. I’ve uninstalled MySQL and re-installed it (again using Yast) and all works fine…until I do the “restart” thing again.

The file “mysql.sock” doesn’t exist anywhere. I’ve tried a variety of so-called “fixes” for this, all to no avail. Surely someone out there has a sure-fire solution to this rather than all the “try this… try that” or “check this…check that” … such a lot of messing around for something that should work from the beginning. What’s wrong with this picture?

help us all somebody puhleeze…and thank you.

Understandably you are frustrated but we are not magicians. You are saying something like “my car goes klunk when I do this”. Well lots of things can cause cars to go “klunk”. Software is not “sure-fire”. A solution that works for one type of klunk will have no effect on another type of klunk. We ask these questions because we need more info to work on. There’s no guarantee of success because we are not at the system and diagnosis by proxy is always difficult.

The mysql service is meant to create a socket at /var/lib/mysql/mysql.sock. This is specified in /etc/my.cnf. You should check if there is this line:

socket          = /var/lib/mysql/mysql.sock

in the mysqld section.

Also have you made sure you have the latest OpenSUSE updates to mysql packages on 10.3 which may include necessary fixes.

I have installed all updates as reported by the OS. Quite “magically” I have now gotten this to work. After re-installing MySQL thru Yast (for the umpteenth time), I issued a command “service mysql restart”. I read this somewhere in the replication documentation. In fact, the documentation stated “service mysqld restart” which doesn’t work at all. Magically it created the /var/lib/mysql/mysql.sock file. I have since re-processed the command a couple times just to ensure it would still work…and it does. My frustration here is twofold…first, the installation of MySQL seems to start the service but the process does not automatically create the sock file (or tho it appears). Secondly, (and I suppose this is my fault for not reading the MySQL installation info) nothing told me after the install that I needed to run the “restart” command to get it to create the sock file. My BAD I guess but coming from a Windows world, I find something like this to be very frustrating. This is not to mention the frustrations I’ve had getting OpenSUSE to share a folder to my Windows workstations (which I managed to eventually do…but it is not very stable) and my now frustrations trying to get replication to work…I guess that is a different forum. In any event, here’s my scenario… I have set up MySQL on the Linux box as well as on a Windows workstation. I have followed various “directions” provided on-line about how to set up replication. I have, in this process, re-installed MySQL a number of times and gone through the replication configuration steps so many times I can almost do it from memory…yet it does not work. Somewhere there must be something missing yet every document I’ve read on this seems to say pretty much the same thing. Interestingly enuf, a few months ago, I was able to get replication working no problem when I had MySQL running on Windows boxes only. ???

ps… thanks for your reply.

Just curious… the Yast installation of MySQL installs 5.0.45 whereas the latest version off the MySQL site is something like 5.0.67. Additionally, 5.1 is available yet when I download either of these "rpm"s, Yast will not install either…what’s up with that?

The socket file is created by the mysql server so it doesn’t have to be created manually. mysqld doesn’t work because the init script is called mysql, not mysqld (it is not uniform across Linux distros). Perhaps that was your original problem, you were using mysqld instead of mysql for the script name. Looks like you are coming from RH. Fortunately SUSE provides the “service” script for people used to the RH syntax. Because you can use bash command completion, rcmysql is easier to get right than service mysql.

Replication works fine on Linux mysql, I have set it up many times. All I can suggest is to go through the replication documentation again, bearing in mind some minor differences in the script names.

Thanks for the help and suggestion Ken… I wonder tho…how many times should I re-go thru the documentation (and the process) before it works…do you have an answer for that? (like 5, 10, 15 times) LOL (just razzin). Seriously tho, I have done this at least 3 times now. It is not working. I have read thru at least 5 documents outlining this “step-by-step” … it’s pretty much the same in each document and seems relatively straight-forward. Perhaps I’m reading all the wrong documents? There are some discrepancies I’ve notices (probably typos) such as one says comment out the line that says “skip-networking” so that it reads #skip-networking and another says uncomment that line (essentially, remove the # ). Perhaps you have some documentation I could refer to?? (something simple please)

Thanks

I don’t have any sure-fire solutions for you but if you can explain to yourself what each step is supposed to do and to verify by other means (e.g. issue some commands on the side to check the status) that what is supposed to happen, has indeed happened, then you stand a better chance of figuring out where it goes wrong. And a better chance of fixing it one day when something needs to be repaired. Otherwise you are just following instructions blind. Unfortunately that’s the way it is. There is no royal road to system administration.

To some extend, I agree; however, having over 20 years in the computer support business, I have solved many, many problems “magically” … meaning, when it (whatever it was) started working, I had no idea what the solution was…it just “happened”. As for “following instructions blind”, that’s about what I am doing now. And that is the reason I came here…to see if anyone can lend me a pair of glasses! Those “glasses” could be in the form of “what commands should I issue and when to check the status of each step”. Most documentation is not as clear as it could (or should) be. for example, one of the documents specifies exactly which “machine” I should be at when I do certain things whereas another document, which provides essentially the same information, doesn’t specify where (ie, on the server machine or the client machine). To my avail, I started out using the one that wasn’t so specific. On the other hand, some other documentation explains everything to the “nth” degree and that makes it difficult to weed out only what one needs. Well, tomorrow is another day and thankfully it’s Friday…maybe I’ll get lucky???

OK… I got replication to work…and here’s how (for the benefit of others).

I’ve scoured 4 different documents (available on-line) about this and all say to enter the following statements into the my.cnf (or my.ini for Windows) file on the client…

[mysqld]
server-id=2
master-host=192.168.0.100 (use your own)
master-user=slave_user (use the one you created)
master-password=secret (use the one you assigned)
master-connect-retry=60
replicate-do-db=exampledb (use your own db name)

Not ONE of those four documents (including the one direct from the MySQL website) said that it should be as follows…

[mysqld]
server-id=2
master-host=‘192.168.0.100’ (use your own)
master-user=‘slave_user’ (use the one you created)
master-password=‘secret’ (use the one you assigned)
master-connect-retry=60
replicate-do-db=‘exampledb’ (use your own db name)

NOTE: the single quotes…

Once I put the quotes in, BINGO!!! it works!

Just goes to show you, ya can’t always trust documentation.

The my.cnf files I have do not require quotes.

Also the recommended method of setting up replication is using CHANGE MASTER where the replication variables such as the replication account and password are stored in a separate file. So those variables are in a separate file created by mysqld anyway.

I have no idea why quoting made a difference for you, your methods seem hit and miss.

One book I can recommend for MySQL is the one by Paul Dubois by SAMS. The author is a senior technical writer at MySQL.

Thanks for the tip on the book. Those “quotes” are inserted into the my.ini (a windows config file). I also did the “CHANGE MASTER” thing (as per instructions in the documentation. Are you suggesting I don’t need to put those statements into the config file on the client and only do the “CHANGE MASTER” thing???

Another question (if you don’t mind?) … now that I’ve figgured out the replication thing, what extra would be necessary to replicate more than one database stored on the same server? For example, I have DatabaseOne and DatabaseTwo. DatabaseOne stores tables for ApplicationOne (a client tracking App) and DatabaseTwo stores tables for ApplicationTwo (an Inventory App) neither of which are associated to each other.

Would I simply have two statements in the config file such as…

On the server:
binlog-do-db=DatabaseOne, DatabaseTwo

On the client:
replicate-do-db=DatabaseOne, DatabaseTwo

or???

And how would I then issue the CHANGE MASTER statement to reflect more than one log file (assuming there would be one that is)? … or would just the one log file hold all the replication info for the 2 databases?

-OR- maybe I should just get the book and do a lotta reading and stop asking so many questions? LOL

By default replication does all databases. To restrict it to some of the databases, see here:

MySQL :: MySQL 5.0 Reference Manual :: 18.2.4 Replicating Different Databases to Different Slaves

This is a little late but may be helpful to others having a similar problem.

I use logrotate to manage system and application log files, mysql logs included. For Mysqlq I had created a separate directory under /var/log/mysql and log all input and output.

One day I had shut Mysql down and was looking over the logging and discovered all these log files named:

slowquery.0000xx

were the xx are sequence numbers 01, 02, … 037, …, 0n

I figured I could do away with these after reviewing and did just that, I romoved all old logs, the gzipped logs managed with logrotate and the slowquery.0000xx sequence logs.

When I went to restart MySql I recived the following error:

***warning: /var/lib/mysql/mysql.sock didn't appear within 30 seconds***

After reviewing MySql’s error.log file I discovered to my dismay that it read:

***/usr/sbin/mysqld: File '/var/log/mysql/slowquery.000037' not found (Errcode: 2)***

Along with numorous other errors related to the log sequence file.

THE SOLUTION

Is very simple. I tailed all the top level log files to zero, nadda, and MySql started right up without a hitch.

Leason learned, be very careful with MySql’s logging mechanisms.

Hope this helps someone.