LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-25-2010, 01:26 PM   #1
mark_alfred
Senior Member
 
Registered: Jul 2003
Location: Toronto, Ontario, Canada
Distribution: Ubuntu Linux 16.04, Debian 10, LineageOS 14.1
Posts: 1,572

Rep: Reputation: 210Reputation: 210Reputation: 210
problems connecting to mysql database


Hello. I'm having problems connecting to the mysql database on my system. I first noticed this when I was trying to set up the program anymeal. I subsequently tried using MySQL Administrator (mysql-admin), but had no luck. It gives my the following feedback:
Code:
Could not connect to host 'localhost'.
MySQL Error Nr. 2002
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Click the 'Ping' button to see if there is a networking problem.
I press the ping button, and it seems to connect.
Code:
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.166 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.165 ms
64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.160 ms
64 bytes from localhost (127.0.0.1): icmp_seq=7 ttl=64 time=0.164 ms
64 bytes from localhost (127.0.0.1): icmp_seq=8 ttl=64 time=0.189 ms
64 bytes from localhost (127.0.0.1): icmp_seq=9 ttl=64 time=0.163 ms
64 bytes from localhost (127.0.0.1): icmp_seq=10 ttl=64 time=0.162 ms
64 bytes from localhost (127.0.0.1): icmp_seq=11 ttl=64 time=0.162 ms
 
Old 08-25-2010, 03:58 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Ping localhost is useless, as it's already up since you're logged in it.
Check if mysqld is running and if the socket is at the location specified
Code:
lsof|grep mysqld.sock
Regards
 
Old 08-25-2010, 06:15 PM   #3
mark_alfred
Senior Member
 
Registered: Jul 2003
Location: Toronto, Ontario, Canada
Distribution: Ubuntu Linux 16.04, Debian 10, LineageOS 14.1
Posts: 1,572

Original Poster
Rep: Reputation: 210Reputation: 210Reputation: 210
I figured it out. Turns out I did not have the server installed. Why this wasn't a dependency of the AnyMeal program, I'm not sure, but anyway, I now got it working. Also, for the AnyMeal program, I needed to set it to "network" from localhost, rather than running from mysqld.sock, which I couldn't get going.
 
Old 08-25-2010, 07:41 PM   #4
joec@home
Member
 
Registered: Sep 2009
Location: Galveston Tx
Posts: 291

Rep: Reputation: 70
Quote:
Originally Posted by mark_alfred View Post
Why this wasn't a dependency of the AnyMeal program, I'm not sure, but anyway, I now got it working.
This is confusing to beginning administrators, we were all there at one time. The reason it is not a dependency is because the MySQL server is not required to be on the local machine. You may have one MySQL server with many workstations attached to it, or you may have one workstation that attaches to many different MySQL servers.
 
Old 08-26-2010, 03:58 AM   #5
vsurlan
Member
 
Registered: Jun 2004
Location: Zagreb, Croatia
Distribution: Debian Lenny
Posts: 49

Rep: Reputation: 15
Quote:
Originally Posted by mark_alfred View Post
Also, for the AnyMeal program, I needed to set it to "network" from localhost, rather than running from mysqld.sock, which I couldn't get going.
When both the MySQL server and the client (AnyMeal in your case) are on the same machine it is much better to work through sockets. Especially if your data is security sensitive. It's faster and you can prevent intrusions by completely disabling networking for MySQL. The fact that you have problems setting this to work via sockets is an indicator that there is something fundamentally wrong in the settings somewhere and I would investigate that further if this is a production setup.
 
  


Reply



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
Connecting to central Mysql database server winairmvs Linux - Software 9 09-18-2009 08:04 AM
connecting to a MySQL database hsa Linux - General 3 09-16-2005 06:34 AM
probs with connecting to mysql database using php ankscorek Linux - Software 4 08-16-2005 07:40 PM
connecting to MYSQL remote database opsraja Linux - Software 1 02-18-2005 05:52 AM
Connecting Mysql Database on remote server akamol Programming 4 10-16-2003 11:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:42 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration