Link to home
Create AccountLog in
Avatar of SupremeBean
SupremeBeanFlag for United States of America

asked on

Newbie just installed MySQL, ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I am on Intel Macbook Pro running Leopard.  I installed PHP and MySQL.  I am now testing all installs with terminal.

-------->Attached Code Snippet here

I had previously confirmed that MySQL was installed in correct place.

I am following a tutorial, and am a complete newbie in this realm.

You should know, I previously tried this a few months ago, and had decided to uninstall it all since I didn't know what I was doing.  I am not sure that the last install is not causing some "leftover" problems?

I also had downloaded Xampp after that. That was not working so I just trashed that, as suggested.

I desperately want to move past this installation.  Thank you for your time.



I just entered, "sudo mysql_secure_installation"  I get:
 
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 
 
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
 
Enter current password for root (enter for none):    (----->I hit "return" here)
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Enter current password for root (enter for none):

Open in new window

Avatar of arnold
arnold
Flag of United States of America image

run netstat -an | grep for mysql.  Did you create/modify my.cnf?

Did you compile mysql, or did you install it from a package?

it is possible that the mysql.sock reference is in a different location ref: http://dev.mysql.com/doc/refman/5.0/en/option-files.html
Avatar of SupremeBean

ASKER

I installed it from it's package.

Are you saying put that line of code in Terminal?  starting at the word netstat?  ending where?

I also don't understand your question: Did you create/modify my.cnf?  Is my.cnf a file?  is it "invisible"?  I don't know how to handle those.

My apologies, I read everything literally because I just do not know.

I appreciate that you answered me so fast, and I want to take advantage of what you gave me so far.  I will check out the link (I can do that much) :)

wow, I checked out your link.  I know that information is very helpful, but I do not understand how to implement any of it.

I am here hoping that people can walk me through stuff.  Can you help me further Arnold?

I appreciate your help and expertise. :)
After installing the mysql package did you start the server?
If not, you should have a file in /etc/init.d named mysql?
run /etc/init.d/mysql start
If no errors, run the script you referenced above.  Do you have the same error?
If everything is working fine, and you want to configure mysql to start when the system start, you need to link a file in /etc/rc3.d/ to /etc/init.d/mysql
ln /etc/init.d/mysql /etc/rc3.d/somefilename
ln -s /etc/init.d/mysql /etc/rc3.d/somefilename
somefilename should have a similar patern to other files in that directory.  If your other files simply have a name of a program, somefilename should be replaced with mysql.




Hi again,

No, I had not started it.  There is a control panel in system preferences that is "supposed" to turn MySQL on and off, but that doesn't work, I have been reading as much on all the Leopard MySQL forums out there.

Let me go start up MySQL (right now I need to restart computer to do that until I figure out on and off with Terminal - which I think you just showed me the start) I want to try with what you just posted, and see how it works.
 
Thanks Arnold!  I'll be right back to post results!  :)
Ugh, I don't think I followed the one direction i understood how to implement.

I started up MySQL by restarting computer, then shut it down, BEFORE I ran:

/etc/init.d/mysql start

Received this error: No such file or directory

When you say, "link a file in....." I do not know what that means.

Also, when I did a spotlight, I did not find the folders, "init.d" or "rc3.d"

Is it possible MySQL did not install it, or could it be somewhere else?  Also, are you giving me explicit Mac/Leopard directions?

As you see, I am VERY new in this realm.  Working with DreamWeaver (for instance) was my latest accomplishment.

If you could give me all directions (or most) as "go in this folder, in this subfolder, to rc3.d......... " That would help me get to where I need to go.

I simply just do not understand.  :(

Thank you for your patience.
I bet what you are telling me is VERY SIMPLE to accomplish, I just don't understand the direction given (the way it is written)

Thanks again.
ASKER CERTIFIED SOLUTION
Avatar of dirknibleck
dirknibleck

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I just put that in, hit return, put in my password, this is what I got (so far):

"Starting mysqld daemon with databases from /usr/local/mysql/data"

Is it still doing something? What should I do next?  What did I just tell it to do?

Can I do this next:  

Thank you for your help.  :)
"sudo mysql_secure_installation"

Open in new window

okay, I looked at the system preferences MySQL panel.  It says it is started.

Is that always the start up command I will use?

Thanks again!!
Avatar of dirknibleck
dirknibleck

Yeah, I always have to run that command when I start my computer if I'm doing anything with MySQL. The MySQL control panel doesn't work properly in Leopard. A friend of mine says it's because of how daemons are managed in the new framework.

When it runs it hangs up the terminal window, and I just close the terminal window, but MySQL will keep running.

You could create an automator script that launches on StartUp, apparently - but I haven't looked into how to do that yet...
It's awesome to hear an expert help, let alone a MAC EXPERT (not to take anything away from Arnold, he knows he stuff, I just don't understand)

So, how do I shut MySQL down, or at least can I now enter my original command: mysql_ secure_installation?

My next command line is blank.

Thanks you dirknibleck, I want to give you points because I feel you know what I need here.

Thank you!  :)

P.S. - I won't lie, I just tried some stuff after what you helped me with - with no feedback.  Hope I didn't kill anything from:
Starting mysqld daemon with databases from /usr/local/mysql/data
$ mysqlshow                    
sudo /usr/local/mysql/bin/mysql_stop
sudo /usr/local/mysql/bin/mysql_shutdown
Computer:~ USER$ sudo /usr/local/mysql/bin/mysql_stop

Open in new window

No worries. I've never run the mysql_secure_installation line, but I would assume that once you have launched the mysqld_safe command and close the terminal - you can open a new terminal and you should be able to launch any mysql commands as per the documentation and they will run.

I use a GUI to interact with mysql, so once I launch the daemon I just open CocaoMySQL and do what I need.

Wow, it IS working now.  You helped me and I am so grateful!!

Obviously you will get the points.  I am sorry to Arnold because he absolutely did try to help me at 2 in the morning!!  I just didn't understand Arnold, sorry.  :(

This Experts Change is going to be my new friend with my new journey into MySQL ad php5.

Thanks again dirknibleck (your user name reminds me of the rock character's name in Galaxy Quest)  LOL

Have a great day, and hope to hear from you again!  :)

No Prob SupremeBean.

Glad to help. I remember how hard it was to find Mac specific instructions on MySQL when I started too...
I really do hope to hear from you again.  Mac Experts are a commodity!!   Take care!! :)