LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-02-2010, 06:19 AM   #1
gty
LQ Newbie
 
Registered: Mar 2010
Posts: 7

Rep: Reputation: 0
mysql server problem


Before I proceed to my question, I just want to say hello to everyone, this is my first post here at LQ

Well, here it is...

I'm try to setup a database server using mysql, the server starts fine, and I can access it using the built in mysql client via console (adding databases and tables works fine), but the problem is... I always get a connection refused error whenever I access the database outside the built in mysql client (example, if I write a code that connects to mysql). So, I tried execute an nmap command and the only ports open are these ports:

PORT STATE SERVICE
22/tcp open ssh
37/tcp open time
113/tcp open auth
6000/tcp open X11
45100/tcp open unknown

there's no 3306 for mysql...

I'm thinking that the firewall is just blocking the port that mysql is using, but my question is, how could the built in client connect to the server if there's no open port for mysql server? Don't clients usually access a servers through ports?

I would appreciate it very much If someone could help me with my problem.

Thanks in advance.

P.S. I'm using the mysql server bundled with Slackware 13.0, I think its version 5.0.84.
 
Old 03-02-2010, 06:41 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Hi

It depends a bit on how MySQL is configured. You should look at the configuration file "/etc/mysql/my.cnf".

The default is meant to be secure. Some versions might have skip-networking, but that's not very common anymore. But it is common to have "bind-address = 127.0.0.1". This means you can connect to it at localhost, but not using the server's ip address. So you can't connect to it from other computers by default. Change it to "bind-address= 0.0.0.0" for it to listen on all ip-addresses.
 
Old 03-02-2010, 06:52 AM   #3
gty
LQ Newbie
 
Registered: Mar 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Oh I forgot to mention that I'm only accessing it locally on the same compter but it still gives me a connection refuse error.

Last edited by gty; 03-02-2010 at 06:58 AM.
 
Old 03-02-2010, 06:59 AM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
It could be that "skip-networking" is on. Then the client will have to connect to it using sockets. Instead of ports, you then give it a socket location for connecting, for example "socket = /var/run/mysqld/mysqld.sock". The mysql console connects to the server like any other program. How it connects should be in the config file. Look under the [client] section.
 
Old 03-02-2010, 07:12 AM   #5
gty
LQ Newbie
 
Registered: Mar 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for pointing me into the right direction. Maybe that's the reason why the only thing that shows up when I grep the nestat for a running mysql service is this:

bash-3.1# netstat -an | grep mysql
unix 2 [ ACC ] STREAM LISTENING 2477624 /var/run/mysql/mysql.sock

I'll try to explore that one and post my progress. Thanks a lot.
 
  


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
Can MySQL log on via SSH/bash? mysql:x:27:101:MySQL Server:/var/lib/mysql:/bin/bash Ujjain Linux - Newbie 2 04-24-2009 02:21 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 03:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM
MySQL server problem after linking (mysql.sock) ewijaya Linux - General 4 01-19-2004 09:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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