开发者

Remote MySQL reading?

I have one question! Is it possible to read from mysql database located on another server?

I have CMS which writes in database on local server, and I want to read with new web page from th开发者_开发问答is database from another server!

Can you please help me?

Tnx!


In your connection parameters that you specify for the database just add the host or hostname parameter. You'll have to check the documentation for the CMS to see how to exactly specify this.


on /etc/mysql/my.cnf (on unix system), comment the line:

bind-address            = 127.0.0.1

and you should be able to connect from anywhere. Note that you may need to allow traffic to that port in your firewall rules.


If your CMS and MySQL boxes are open to each other on the network, there's no reason why you can't use a different box, providing you know the database box's hostname and credentials.


Yes, it's possible. Just add the hostname of the MySQL machine instead of localhost when connecting.

This requires three things:

  • The MySQL server allows remote connections
  • There's no firewall blocking this traffic (as is the case on many cheap web hosts)
  • The MySQL privileges on your user is configured to allow connection from remote hosts (sometimes the users are set to user@localhost in the privilege table, which disallows all remote connections for that user).


MySQL can connect over TCP/IP. If you have database server D configured as such, then Client C can connect to it from anywhere. On most systems, by default D will only allow local connections, local clients. Please refer to the "GRANT" documentation on how to grant clients the right to connect from remote.

MySQL can also replicate. Meaning you have several database servers, which make sure that between them, the data is always up-to-date. Obviously this is much harder then it might sound :). Usually, you will set up some sort of master-slave replication: A master database allows writing to, and it will make sure that sometime soon, all its slaves get the newest data past along. clients can then read from any server, be it slave or master.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜