LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-10-2011, 11:09 AM   #1
invader7
LQ Newbie
 
Registered: Jun 2011
Posts: 24

Rep: Reputation: Disabled
Mysql accept remote connections


Hello, i want mysql to accept remote connections so i found this guide http://www.cyberciti.biz/tips/how-do...se-server.html and i followed it.

Step # 5 Grant access to remote IP address

i want "How Do I Grant Access To An Existing Database?"

mysql> update db set Host='202.54.10.20' where Db='webdb';
mysql> update user set Host='202.54.10.20' where user='webadmin';

doesn't helped me so i added the user from the phpmyadmin page.


Finally , my mysql does not accept remote connections. Do you have another guide ? or an idea whats going wrong ?
 
Old 10-10-2011, 12:34 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,215
Blog Entries: 1

Rep: Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067
Hi,

Make sure you don't use a "skip-networking" either in my.cnf, or in the mysqld service startup script.
You can run
Code:
netstat -tanpl|grep mysql
to see if mysqld is listening and on what IP(s)

Regards
 
Old 10-10-2011, 01:21 PM   #3
invader7
LQ Newbie
 
Registered: Jun 2011
Posts: 24

Original Poster
Rep: Reputation: Disabled
thanks for the command.


root@b0x:~# netstat -tanpl|grep mysql
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 28329/mysqld


root@b0x:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- x.x.x.x anywhere tcp dpt:mysql

x.x.x.x = the ip of the client i want to connect


[mysqld]
#
# * Basic Settings
#
...
bind-address = my server real ip here
#skip-external-locking
 
Old 10-10-2011, 02:23 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,215
Blog Entries: 1

Rep: Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067
Quote:
root@b0x:~# netstat -tanpl|grep mysql
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 28329/mysqld
mysqld is listening only on the local loopback interface, that's why you cannot connect from other boxes. Are you sure you use your server public IP in the "bind-address" option?
Try to comment out the "bind-address", as by default mysqld will listen on all available interfaces, and restart the service.
 
Old 10-10-2011, 02:55 PM   #5
invader7
LQ Newbie
 
Registered: Jun 2011
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
mysqld is listening only on the local loopback interface, that's why you cannot connect from other boxes. Are you sure you use your server public IP in the "bind-address" option?
Try to comment out the "bind-address", as by default mysqld will listen on all available interfaces, and restart the service.
i already have it as you say , look at my latest post , the line does not have # in front of it

thanks for helping
 
Old 10-10-2011, 03:14 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,215
Blog Entries: 1

Rep: Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067
Quote:
i already have it as you say , look at my latest post , the line does not have # in front of it
Yeah I saw that, but since it's not working (as mysqld listens on 127.0.0.1), I told you to comment it out (add the # in front) and restart mysqld.
Could be that you're using the wrong my.cnf. Usually it's located in /etc/my.cnf
 
Old 10-10-2011, 03:30 PM   #7
invader7
LQ Newbie
 
Registered: Jun 2011
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Yeah I saw that, but since it's not working (as mysqld listens on 127.0.0.1), I told you to comment it out (add the # in front) and restart mysqld.
Could be that you're using the wrong my.cnf. Usually it's located in /etc/my.cnf
its the only my.cnf
 
Old 10-10-2011, 05:23 PM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,215
Blog Entries: 1

Rep: Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067
Could be the only my.cnf, but mysqld looks like it doesn't use it. Did you try to comment out the "bind-address ...' line and see what happens?
You could also edit the /etc/init.d/mysqld (or whatever is called the startup script for your distro) and add either a "--no-defaults" or a "--defaults-file=/etc/my.cnf" among the other startup options
 
Old 10-10-2011, 09:36 PM   #9
rameshshihora
LQ Newbie
 
Registered: Jul 2007
Posts: 16

Rep: Reputation: 0
Hello,

Please check your servers /etc/hosts file.

< IP > localhost.localdomain localhost

If the above entry present the comment it our and make it like this:

< IP > <Servers FQDN>

Thanks & Regards,
Ramesh Shihora
 
Old 10-11-2011, 05:43 AM   #10
invader7
LQ Newbie
 
Registered: Jun 2011
Posts: 24

Original Poster
Rep: Reputation: Disabled
thanks for helping my problem solved , my.cnf had 2 bind-address lines (the other one was far too down)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 remote connections from Windows Spetnik Linux - Server 11 09-25-2011 09:45 AM
Allow remote connections MySQL server Skillz Linux - Server 3 06-03-2009 12:34 AM
proftpd: cannot accept connections lievendp Linux - Software 1 01-24-2006 09:41 AM
MySQL + Debian + MySQLCC + Remote Connections, How? Mulsiphix Linux - Newbie 3 01-07-2006 05:46 PM
rsh doesnt accept connections Xris718 Linux - General 3 05-19-2005 03:14 PM

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

All times are GMT -5. The time now is 05:37 AM.

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