Page 1 of 1

MySQL Server on Home Machine

Posted: Sat Jul 02, 2005 12:24 pm
by Sid3335
I have a mysql and php running on apache on my home computer. Everything works fine and is setup correctly.

I also have a site hosted on servers running php and mysql.

I have a script that connects to a mysql database server and creates a database. it runs fine on both servers.

The problem is trying to connect to my home mysql server from my hosted site on the net. I understand i can't connect to my hosted server from home as my hosting provider does not allow it.

BUT!!how could i connect to my mysql server on my home computer from my web hosted site.


would i connect using my web facing i.p address?
(that can be found using http://www.whatismyip.com/)
when i try to connect using this i.p it returns an error saying:

mysql_connect(): Access denied for user 'root'@'server218-iis641.livedns.org.uk' (using password: YES)

what am i doing wrong, is server218...etc the dns server?
why is access denied i'm sure the password is correct?

i guess it is actually trying to connect to the correct server, but why is access denied?
thanks for any help.

Posted: Sat Jul 02, 2005 1:07 pm
by onion2k
Is port 3306 open to external connections on your firewall?

Posted: Sat Jul 02, 2005 1:16 pm
by Sid3335
yeah its open.

I have no idea what the problem is, its obviously a privilege problem, as the error doesn't say can't connect to database.

It states that root does not have access, but how can that be when root has adminstrator rights, doesn't it?

Posted: Sat Jul 02, 2005 1:54 pm
by Chris Corbyn
Well if you managed to produce that error message there's no firewall problem since MySQL itself provided the error.

What you do seem to have is a privilege problem.

You need to add your server to the list of allowed hosts (add a user).

Fire up your command line and start mysql with the mysql prompt. If you're on windows and mysql hasn't been added to the path directory you have to browse to the bin folder for the installation beofre issuing the mysql prompt.

Code: Select all

-- bash -$ mysql -u username -p
Password:
Welcome to the MySQL server.
Your connection ID is XX.
Blah Blah Blah...

mysql> GRANT ALL PRIVILEGES ON databasename.* TO 'username'@'xxx.xxx.xxx.xxx';
Query OK
0 Rows affected.
mysql> _
Where xxx.xxx.xxx.xxx is the IP address of your web host.

phpMyAdmin might have this functionality too I think ;)

Posted: Sat Jul 02, 2005 1:55 pm
by timvw
Imho, there is simply no good reason to give external root access.

Anyway,

Code: Select all

GRANT ALL ON database.* TO 'user'@'*' IDENTIFIED BY 'password'
The default root is root@localhost... Instead of root@*

Posted: Sat Jul 02, 2005 2:50 pm
by Sid3335
ok thanks guys,

i granted privileges and now i get this

mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in

any ideas?

Posted: Sat Jul 02, 2005 2:51 pm
by Sid3335
sorry guys, it's now working thanks for all your help.

I just cahnged it from root to another user and it now works.

Cheers