PDA

View Full Version : Remote connection to MySQL


Landy
04-29-2005, 12:58 PM
I am trying to connect to a MySQL database remotely in order to run DBDesigner 4 from fabForce.net running on my local Win2K PC. I went to the control pannel and entered my IP address in the Host Access Control section of the MySQL Manager, but I get an access denied error message. I also tried to connect from the mysql command on a Linux box and got the same message. I have tried connecting as both the dbAdministrator user and another user I created to which I assigned FULL access rights.

Any other ideas what I should do? Does anyone else out there connect remotely?

iDxMan
05-01-2005, 10:31 PM
Grant your user rights from either your specific IP or use % for any IP. Typically grants are created with access from the localhost.

http://dev.mysql.com/doc/mysql/en/grant.html

Landy
05-02-2005, 09:37 AM
I figured it out. The problem was not the permissions (I had already set those), the problem was the username. I had assigned a username of Fred using the control panel tool, but was not observant enough to realize that the actual username assigned was dbName_Fred. Once I added the database name in front of the username, all worked as it should.

Thanks

Viper007Bond
05-03-2005, 06:45 AM
For future reference, when doing like mysql_query or whatever, it's best to do something like this:

mysql_query("query here") or die(mysql_error());

That'll show you the error. ;)

Landy
05-03-2005, 05:48 PM
Thanks Viper007Bond. The code you suggest is exactly what I use on my web pages accessing the database. Everyone should do this on their web pages.

In this case I was trying to access the database from a remote computer, so could figure no way to get an error message more informative than access denied.

By the way, if you have not tried out the free database modeling software DBDesigner 4 from fabForce.net you should. It is very user friendly, helps visualize your relational database and even helps you figure out complex SQL queries. Apparently it has reached end of life, but will rise again as the official database modeler at MySQL.com