MySQL Server on Home Machine

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
Sid3335
Forum Newbie
Posts: 9
Joined: Fri Jun 24, 2005 4:00 pm

MySQL Server on Home Machine

Post 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.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Is port 3306 open to external connections on your firewall?
Sid3335
Forum Newbie
Posts: 9
Joined: Fri Jun 24, 2005 4:00 pm

Post 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?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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 ;)
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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@*
Sid3335
Forum Newbie
Posts: 9
Joined: Fri Jun 24, 2005 4:00 pm

Post 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?
Sid3335
Forum Newbie
Posts: 9
Joined: Fri Jun 24, 2005 4:00 pm

Post 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
Post Reply