473,789 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error# 2002 can't connect to local mysql server '/var/mysql/mysql.sock' (2)

7 New Member
Hey Guys, you helped me once when I tryied to create a database : "Access denied for user ''@'localhost' ". On my Mac OS 10.4, I had no problem creating database and modifying it from the terminal. But I use Dreamweaver 8 to connect to MySQL, with its built-in feature "MySQL Connection" I write this:

Connection Name: con_test001
MySQL Server: localhost
User Name: root
Password: 55555
Database: test001 (which is a database I already createde using the terminal)


But when i click test i get this message:
MySQL Error# 2002
Can't connect to local mysql server '/var/mysql/mysql.sock' (2)

I Understand that some people have the same problem even when they aren't working with dreamweaver, only php and a text editor. I also tried to this:

cd /var
sudo mkdir mysql
cd mysql
sudo ln -s /private/tmp/mysql.sock mysql.sock


but It didn't work. i log on this way:
/usr/local/mysql/bin/mysql -u root –p

pbmods if you could help me with this again, i would appreciate it. Thank you
Oct 11 '07 #1
6 6326
pbmods
5,821 Recognized Expert Expert
Heya, markodilore.

Is MySQL running? Try running this in the Terminal:

Expand|Select|Wrap|Line Numbers
  1. ps -axc | grep mysqld
  2.  
If nothing comes up, then the database server is not running.

Try running this command:
Expand|Select|Wrap|Line Numbers
  1. sudo /usr/local/mysql/bin/mysql.server start
  2.  
The mysql.server file might not be in /usr/local/mysql/bin; it might be in /usr/local/mysql/support-files instead.
Oct 12 '07 #2
markodilore
7 New Member
Hey pbmobs, thanks for aswering me, again. I wrote that command and i got this message:

Expand|Select|Wrap|Line Numbers
  1. Marko-Dilore-Computer:~ markodilore$ ps -axc | grep mysqld
  2. 252  ??  S      0:00.55 mysqld
So I guess the server is running. Should i write the second part any way. because I keep getting that error message. thanks!
Oct 13 '07 #3
pbmods
5,821 Recognized Expert Expert
Heya, markodilore.

Try restarting your MySQL server. Issue the following commands:
Expand|Select|Wrap|Line Numbers
  1. > /usr/local/mysql/bin/mysql.server stop
  2. > /usr/local/mysql/bin/mysql.server start
  3.  
As always, mysql.server might be in /usr/local/mysql/support-files instead.
Oct 13 '07 #4
markodilore
7 New Member
Hey pbmods, thanks a lot. I wrote that code and it did turn mysql off and back on, I did it inmedietely following the other one:

Expand|Select|Wrap|Line Numbers
  1. Last login: Mon Oct 14 09:34:33 on console
  2. Welcome to Darwin!
  3. Marko-Dilore-Computer:~ markodilore$ sudo /usr/local/mysql/support-files/mysql.server stop
  4. Shutting down MySQL.. SUCCESS! 
  5. Marko-Dilore-Computer:~ markodilore$ sudo /usr/local/mysql/support-files/mysql.server start
  6. Starting MySQL SUCCESS! 
  7. Marko-Dilore-Computer:~ markodilore$
But I still keep getting the error message, maybe i shouldn't have turned it back on right away, shoul I try to connect to mysql in a different way or is there something in this directory: '/var/mysql/mysql.sock' that need to be fixed. Please help me, thank you.
Oct 15 '07 #5
wunderwood
1 New Member
I may be mistaken, but I believe that I fixed this by editing the /etc/my.cnf file. There are sections in there for both the mysql CLIENT and the mysql SERVER. At first I mistakenly just changed the first instance of "socket" and not the second one.

For me the fix was to change both occurrences of socket to

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

HTH,

wunderwood
Nov 10 '07 #6
r035198x
13,262 MVP
I may be mistaken, but I believe that I fixed this by editing the /etc/my.cnf file. There are sections in there for both the mysql CLIENT and the mysql SERVER. At first I mistakenly just changed the first instance of "socket" and not the second one.

For me the fix was to change both occurrences of socket to

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

HTH,

wunderwood
Yep that can also do it.
Another reason could be that MySQL is looking fo the sock file in /tmp instead. Moving the mysql.sock file from /var/lib/mysql/ to /tmp would do it.
Nov 12 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1986
by: Mechphisto | last post by:
Not sure if this is truly a mySQL issue or a PHP issue, since the problem started when I reconfigured/made a PHP upgrade:We're using RedHat ES2.1. With PHP 4.1.3 and phpMyAdmin 2.5.6, it was working fine. Then I upgraded to PHP 4.3.4. And I started getting the error: MySQL said: #2002 - Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) through phpMyAdmin, and from mySQL at the command line: #2002 - Can't connect...
0
2186
by: Matthew Robinson | last post by:
i get this when i do '/etc/rc.d/rc.mysql start' ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2) ive had a look on google, and the problem for most people seems to be permissions, but im running as root, and the socket doesn't exist. It doesn't create the socket when it runs, because i tried putting mysql in the root user group.
3
17810
by: Pugi! | last post by:
On a freshly installed Fedora C3 (incl. webserver apache php mysql) i get the following problem when connecting to mysql through a browser (phpMyAdmin): : #2002 Can't connect to local MySQL server through socket /var/lib/mysql/mysql.sock On the website of MySQL this error is mentioned but I found no solution. In /var/log/messages the following log occurs :
1
121535
by: jiing | last post by:
Now let me describe what I have done and my purpose: Originally, I want to user ports to install phpBB But I found that phpBB doesn't support mysql 5.x (but the ports installed mySQL 5.0.0 alpha) so I deinstall mysql5-server and mysql5-client And then I install mysql41-server and mysql41-client on FreeBSD 5.3 by ports but now , mysql is not workable
2
31270
by: B Squared | last post by:
This is a bit of a newbie question -- I've just installed MySQL 4.1.13 on a Fedora core 3 system. It installed great. It wasn't hard to get it running and create a few databases. But I can't seem to make the client shell run from anywhere but the mysql/bin directory. I've placed the /usr/local/mysql/bin directory in my PATH, but I still have to change to this directory to make the MySQL shell to work. If I'm try to run it from any other...
2
2746
by: xiuchuanli | last post by:
I install Fedora 4 with web server, after that I installed mysql 5.0.15. Now I can connect to mysql from command line and mysql-administrator and mysql-query-browser. But when I try to test to connect from php code, it told me that "can not connect to local mysql through /tmp/mysql.sock. /tmp/mysql.sock is my sock file to connect and permission is set good. when I add phpinfo() to my php code, it show me that mysql lib php uses is 4.1.X,...
1
4512
by: linux | last post by:
Sorry if this is a really dumb question. I am trying to connect to our remote MySQL server (which is running just fine). I have a perl script which worked just fine on my other Fedora 4 box (all servers are Fedora 4 with latests updates). The one that worked fine it down and I cannot compare anything against it (it was a client also). My problem is, when I try to connect to the server I get:
1
1665
JohanK
by: JohanK | last post by:
Hi there, I really need some help setting up mySQL. I'm running redhat enteprise linux 3.1 and the following rpm's are installed, mysql-3.23.58-16.RHEL3.1 libdbi-dbd-mysql-0.6.5-5 mysql-devel-3.23.58-16.RHEL3.1 Now my problem is that every time I try to connect to mysql I get the following error: ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
2
3402
by: Moises | last post by:
Hi, I just installed MySQL using "yum install mysql" and when I try to run it I get this error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) When I try to start the service using "service mysqld start" I get this message: mysqld: unrecognized service Please help. Moises
0
9499
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5539
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2898
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.