View Full Version : Howto access MySQL remotely?
LordMerlin
07-21-2006, 02:56 PM
Hi all
I wonder if someone can shed some light on the topic. I need to acces my MySQL DB remotely. Why? Simple. I have quite a few apps (like cerberus, phplist, Joomla) which keep on kicking me out. I have figured out it's something todo with sessions.
How? I use ADSL, and have switched hosts already, cleared all three my browser's cache, and tried it on my spare laptop and my wife's PC.
So, we can work this out differently. Since most of these sites are DB driven, I could install them all my my own server in the office, and connect to the DB on my VPS.
Problem.
I keep on getting the error: ERROR 1045: Access denied for user 'root'@'dsl-xxx-xx-xx.telkomadsl.co.za' (using password: YES)
I have added my IP, and my ADSL asigned DNS entry to the allowed hosts in cPanel, and even tried using %, but it doesn't work.
BTW, I added this entry to my /etc/apf/allow_hosts.rules file to get it to allow me through the firewall for that port. So it's not the firewall blocking me, it's MySQL. Any suggestions?
Is there like a global rule which denies all "foreign" connections to the MySQL server in cPanel?
MarkB
07-21-2006, 03:55 PM
If you need access for one DB only go to domain.com/cpanel client -> MySQL Databases and add "Access Host" (bottom of the page)
If you need to connect to all DBs (back ups etc) go to WHM -->SQL Services -->phpMyAdmin and add user to MySQL database. Enter your IP in host field, user un user field and password in password field. Assign privileges throu phpmyadmin.
Don't forget to add MySQL standard port (3306) to your firewall allowed_hosts
LordMerlin
07-21-2006, 04:06 PM
I have already done that:
I have added my IP, and my ADSL asigned DNS entry to the allowed hosts in cPanel, and even tried using %, but it doesn't work.
BTW, I added this entry to my /etc/apf/allow_hosts.rules file to get it to allow me through the firewall for that port. So it's not the firewall blocking me, it's MySQL. Any suggestions?
I had port 3306 in the firewall, but that opens the MySQL port for everyone, so I put my host in the allow_hosts.rule file
The problem is not with the firewall, else I wouldn't have gotten the password error
MarkB
07-21-2006, 04:30 PM
You have to add host 'dsl-xxx-xx-xx.telkomadsl.co.za' to your DB
StingRay
07-21-2006, 11:51 PM
Just because you have put your Ip/port in apf does not mean it will work right away. I had an issue where the iptables were not in sync with apf (or some such thing). You should restart iptables and apf possibly.
MarkB
07-22-2006, 04:35 AM
The problem is not with the firewall, else I wouldn't have gotten the password errorRead again my first reply. MySQL server doesn't allow connections which aren't specified in main MYSQL server database user table. This database is named "mysql".
In my first post I've explained how to add extra hosts...
LordMerlin
07-22-2006, 05:22 AM
Ok, now you lost me.
In my main MySQL database, mysql, I run this:
SELECT * FROM `user` WHERE host = 'dsl-146-18-31.telkomadsl.co.za
dsl-xxx.xxx.xxx.telkomadsl.co.za softdux_cerberus *{encrypted-password} N N N N N N N N N N N N N N N N N N N N N [BLOB - 0 Bytes] [BLOB - 0 Bytes] [BLOB - 0 Bytes] 0 0 0
This automatically get's put into the mysql tables when you add a host in cPanel, under MySQL databases > Add remote host.
This can also be done by logging into the main MySQL DB, clicking on the priviledges and then adding the allowed host field.
Anyway, not to worry. I'm not going to bother with this anymore. I'll try another program. Cerberus isn't the only helpdesk around, and they were not much of a help at all
MarkB
07-22-2006, 04:29 PM
Ok, now you lost me.
SELECT * FROM `user` WHERE host = 'dsl-146-18-31.telkomadsl.co.za
dsl-xxx.xxx.xxx.telkomadsl.co.za softdux_cerberus *{encrypted-password} N N N N N N N N N N N N N N N N N N N N N [BLOB - 0 Bytes] [BLOB - 0 Bytes] [BLOB - 0 Bytes] 0 0 0
You see all those Ns? It means you didn't grant privileges to that user.
DB user isn't useful without privileges.
Change Ns to Ys and you'll be setup to go...
Vonna.com
08-25-2006, 03:37 AM
Remember if you use old application like MysqlFront etc.. you need to check
"Use old style (4.0) passwords with mySQL 4.1+ (required if you have problems with php apps authenticating)"
Under Tweak Settings ( in WHM ) :)
LordMerlin
10-18-2006, 11:36 AM
Remember if you use old application like MysqlFront etc.. you need to check
"Use old style (4.0) passwords with mySQL 4.1+ (required if you have problems with php apps authenticating)"
Under Tweak Settings ( in WHM ) :)
Thanx, this was the problem :)
Sorry for the late reply, forgot about the problem untill recently....
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.