connect to mysql server from remote on redhat

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
cade
Forum Commoner
Posts: 55
Joined: Tue Jul 03, 2007 8:18 pm

connect to mysql server from remote on redhat

Post by cade »

helllo

I just made a quick reference and found a lot of things on how to connect remote to server.

How to configure the mysql server and client? And what is SSH? Do i need to adjust IP tables. Can someone guide me?

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Did searching not give you any leads?
cade
Forum Commoner
Posts: 55
Joined: Tue Jul 03, 2007 8:18 pm

Post by cade »

no
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: connect to mysql server from remote on redhat

Post by VladSun »

cade wrote:How to configure the mysql server and client?
You'll have to GRANT users on the remote machine (client) some prvileges. Example:

Code: Select all

mysql> grant all on database_name.* to user_name@host_name_or_ip identified by 'your_password_for_remote_client_here';
cade wrote:And what is SSH?
It is secured connection to your server - e.g. you can run shell commands in the server. If you are using Windows on the client PC search for "PuTTY".

cade wrote:Do i need to adjust IP tables.
It is "iptables" :)
It is the "firewall" for Linux based servers. You will have to open port 3306 for the client's host. E.g.:

Code: Select all

iptables -I INPUT -p tcp --dport 3306 -s CLIENT_IP_HERE -j ACCEPT
iptables -I OUTPUT -p tcp --sport 3306 -d CLIENT_IP_HERE -j ACCEPT
Also, you have to check if you MySQL server accepts TCP connections - you should run it without "--skip-networking" option. The same applies to your MySQL config file.
There are 10 types of people in this world, those who understand binary and those who don't
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I wouldn't allow external connections to the database, because (afaik) mysql sends unencrypted data... I'd rather setup an ssl tunnel and send the data over that connection.

eg:

Code: Select all

ssh -N -L 3307:example:3308 timvw@example
Now my program can connect to localhost:3307and ssh will make sure that it ends up at example.:3308 without others being able to see the actual data :) For windows users i suggest that you take a look at Plink.
cade
Forum Commoner
Posts: 55
Joined: Tue Jul 03, 2007 8:18 pm

Post by cade »

I have try to update user and set new password for new user and new host.

I also have adjusted my.cnf file and bind the IP address to mysql server.

Can anyone tell me what is going on?
I don't like linux.
It's not friendly to me.

The iptables also not present in my client's linux system. How can I bypass this setting

I have search all over the internet to revoke those setting but now it didn't work. It really depressed when things become more worse than I thought. Please advise how to revert those setting. Please....
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

OK. Let's do some checks:

First run

Code: Select all

netstat -ntap | grep mysql
You chould get an ouput like this:

Code: Select all

tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN
Please, post it here.

If you it isn't the case run:

Code: Select all

pgrep mysqld
You should get an output containing several lines with numbers - if it isn't the case then mysql is not runing.

If iptables is not installed on your system, then probably you don't have a firewall at all, so it isn't a firewall problem.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

OK. Let's do some checks:

First run

Code: Select all

netstat -ntap | grep mysql
You chould get an ouput like this:

Code: Select all

tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN
Please, post it here.

If you it isn't the case run:

Code: Select all

pgrep mysqld
You should get an output containing several lines with numbers - if it isn't the case then mysql is not runing.

If iptables is not installed on your system, then probably you don't have a firewall at all, so it isn't a firewall problem.

PS: "Linux is unfriendly" - you mean it is not a "NxNext clicks" administration ;)
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply