LinuxQuestions.org
Review your favorite Linux distribution.
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 11-29-2003, 04:49 AM   #1
Rukawa
LQ Newbie
 
Registered: Nov 2003
Posts: 3

Rep: Reputation: 0
Question MySQL connection over TCP/IP fails


I have just finished setting up MySQL and PostgreSQL on my webserver, and both are running fine when I work from a shell on the server. For instance, I can connect to the MySQL from the shell, by typing
mysql

but if I try to connect through an IP address, i.e. by writing
mysql -h 127.0.0.1 --user root -p

I get the message
ERROR 2003: Can't conenct to MySQL server on '127.0.0.1" (111)

My firewall is properly configured to allow connections on 3306 so I doubt that that is the problem. In order to get the PostgreSQL server to accept connections, I had to add a crypitc line to the
/etc/rc.d/init.d/postgresql

file. Do I need to do something similar to get MySQL to accept connections?

I am using Fedora Core on an x86 machine

/Rukawa
 
Old 11-29-2003, 11:03 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
See if it is listening with:
netstat -nlp

You may need a port option to be set - see:
http://www.mysql.com/doc/en/Option_files.html
 
Old 11-29-2003, 12:51 PM   #3
Rukawa
LQ Newbie
 
Registered: Nov 2003
Posts: 3

Original Poster
Rep: Reputation: 0
Looks like it is listening:
unix 2 [ ACC ] STREAM LISTENING 17645 4461/mysqld /var/lib/mysql/mysql.sock

I tried adding the
port = 3306
to my.inf and the other suggestions from that site, but I still can't connect...
 
Old 11-29-2003, 03:26 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
It should be /etc/my.cnf

Then restart mysql.

That line only shows a listening socket.
 
Old 11-29-2003, 11:30 PM   #5
Rukawa
LQ Newbie
 
Registered: Nov 2003
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for the help it works now! I cleaned up the /etc/my.cnf file removing unnecessary info and added the port number as you explained. Restarted and now it works :-D

To other people: Note the [client] area where port and socket should be set, and note the list of skip-... statements that appear in the ini file. "skip-networking" must NOT appear if you want TCP/IP to work.

/Rukawa
 
  


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
MySQL over TCP? Waerner Linux - Software 6 07-13-2005 08:05 PM
[ JSP/JAVA ] MySQL connection fails White R4bbit Programming 4 04-27-2005 08:31 AM
MySQL ODBC driver fails when trying to add a DSN to MySQL banjoman Linux - Software 0 01-24-2005 09:59 AM
MySQL seg fault using TCP connection ugenn Linux - General 1 12-27-2002 03:15 PM
Unable to get TCP/IP connection kgunnar Linux - Newbie 9 05-01-2002 04:24 AM

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

All times are GMT -5. The time now is 08:37 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