Jump to content

Recommended Posts

Posted

Based on your statement/question it sounds like you have set up a user on the MySQL server and that user has permission to make a connection from your web server. Once the user is in place, three things are needed to make the connection to your MySQL server. A hostname, username and password. When using php it will look something like this...

 

$dbhost = 'NameorIPofMySQLhost';
$dbuser = 'papasmurf';
$dbpass = 'lalalalalalaa';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

 

If the web server and MySQL server are one in the same you can use 'localhost' as your $dbhost.

Posted

Close, but I believe you also have to have a port number in there. The "$dbhost" value needs to be "heliohost.org:3306".

Posted

Good idea to mention the optional inclusion of a port value. From my understanding it is only necessary if the default port (3306) is not used and the mysql.default_host directive is undefined. Here is an excerpt from the PHP: mysql_connect - Manual.

 

server

The MySQL server. It can also include a port number. e.g. "hostname:port" or a path to a local socket e.g. ":/path/to/socket" for the localhost.

 

If the PHP directive mysql.default_host is undefined (default), then the default value is 'localhost:3306'. In SQL safe mode, this parameter is ignored and value 'localhost:3306' is always used.

 

Posted

The point I was trying to make is that I am trying to access MySQL from another server than my webserver...

 

But if I understood you correctly, I just have to use heliohost.org:3306

Is that right?

Posted

Yes, that is what you should have to use. Currently when i am connecting using remote mysql i keep getting an error but it should still work.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...