Jump to content

connecting to a database on another server???


ldoozer

Recommended Posts

if you are connecting from another host, the hostname specified in the connect statement has to be the host you are calling from, not the host the mysql is on.  most shared hosts dont allow that and you would have to have a dedicated server with root access to the server to do that.
????

The host name has to be the host of teh database - otherwise you'd never know where you are connecting to.

There is the potential that the hosts of the database you are trying to connect to do not allow access from outside the server. BUT be absolutely sure you have the correct host name.

You may also have to specify which port to connect on.  Get in touch with the hosts of teh database you are trying to connect to and ask them exactly what details you need to connect remotely to the database.
what ToonMariner said about the hostname is correct.  what I meant is that the mysql usernames/ passwords have to be set up to be called from a particular domain which is usually localhost.  If you have a username/password that works on the server the db is on, then they will not work if called remotely.  The difference, in mysql code is like this:

[code]-The first account can access the bankaccount database, but only from the local host.
-The second account can access the expenses database, but only from the host -whitehouse.gov.
-The third account can access the customer database, but only from the host server.domain.

To set up the custom accounts without GRANT, use INSERT statements as follows to modify the grant tables directly:

shell> mysql --user=root mysql
mysql> INSERT INTO user (Host,User,Password)
    ->    VALUES('localhost','custom',PASSWORD('obscure'));
mysql> INSERT INTO user (Host,User,Password)
    ->    VALUES('whitehouse.gov','custom',PASSWORD('obscure'));
mysql> INSERT INTO user (Host,User,Password)
    ->    VALUES('server.domain','custom',PASSWORD('obscure'));[/code]
--that creates passwords for 3 different users in the mysql password tables
--only the first which uses 'localhost' is allowed by most shared hosts for security reasons

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.