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.
MySQL Server on Home Machine
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
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.
Where xxx.xxx.xxx.xxx is the IP address of your web host.
phpMyAdmin might have this functionality too I think
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> _phpMyAdmin might have this functionality too I think
Imho, there is simply no good reason to give external root access.
Anyway,
The default root is root@localhost... Instead of root@*
Anyway,
Code: Select all
GRANT ALL ON database.* TO 'user'@'*' IDENTIFIED BY 'password'