Basically, I need to connect to another database on a different domain.
For example, I'll use domain1 and the domain that needs to connect, and domain2 as the domain that has the database.
I have tried:
mysql_connect("domain2.com.au", "user", "pass") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
Although, that refused to work.
I looked for quite some time online to find a solution, and many of them involved logging into SSH which I am not familiar with and I would like to avoid this method.
If needed, here is my error (some things modified for privacy):
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user'@'host.com' (using password: YES) in /php/2012.php on line 270
Access denied for user 'user'@'host.com' (using password: YES)
Is there an option that I must change within my database to allow access from other domains? If so, where exactly is this?
Is there a port that I need to connect to such as domain2.com.au:3307?
解决方案
If you are using shared hosting, then it's disabled. You could try enabling it by contacting your support department, or if you have cPanel x3 go to Remote Database section in your MySQL section.