http://mysql.nctu.edu.tw/doc/R/e/Replication_HOWTO.html上面教你如何使mysql有这个功能
另外:
MySQL doesn't (yet) have database replication, but here are some info on how do to it. The most general way to replicate a database is to use the update log. See section 10.2 The update log. This requires one database that acts as a master (to which data changes are made) and one or more other databases that act as slaves. To update a slave, just run mysql < update_log. Supply host, user and password options that are appropriate for the slave database, and use the update log from the master database as input. If you never delete anything from a table, you can use a TIMESTAMP column to find out which rows have been inserted or changed in the table since the last replication (by comparing to the time when you did the replication last time) and only copy these rows to the mirror. It is possible to make a two-way updating system using both the update log (for deletes) and timestamps (on both sides). But in that case you must be able to handle conflicts when the same data have been changed in both ends. You probably want to keep the old version to help with deciding what has been updated. Because replication in this case is done with SQL statements, you should not use the following functions in statements that update the database; they may not return the same value as in the original database: DATABASE()
GET_LOCK() and RELEASE_LOCK()
RAND()
USER(), SYSTEM_USER() or SESSION_USER()
VERSION()
All time functions are safe to use, as the timestamp is sent to the mirror if needed. LAST_INSERT_ID() is also safe to use.
另外:
MySQL doesn't (yet) have database replication, but here are some info on how do to it. The most general way to replicate a database is to use the update log. See section 10.2 The update log. This requires one database that acts as a master (to which data changes are made) and one or more other databases that act as slaves. To update a slave, just run mysql < update_log. Supply host, user and password options that are appropriate for the slave database, and use the update log from the master database as input. If you never delete anything from a table, you can use a TIMESTAMP column to find out which rows have been inserted or changed in the table since the last replication (by comparing to the time when you did the replication last time) and only copy these rows to the mirror. It is possible to make a two-way updating system using both the update log (for deletes) and timestamps (on both sides). But in that case you must be able to handle conflicts when the same data have been changed in both ends. You probably want to keep the old version to help with deciding what has been updated. Because replication in this case is done with SQL statements, you should not use the following functions in statements that update the database; they may not return the same value as in the original database: DATABASE()
GET_LOCK() and RELEASE_LOCK()
RAND()
USER(), SYSTEM_USER() or SESSION_USER()
VERSION()
All time functions are safe to use, as the timestamp is sent to the mirror if needed. LAST_INSERT_ID() is also safe to use.
解决方案 »
- 请教合并两个UPDATE 语句的问题!
- mysql能和sql2000用在一台电脑上吗?
- 菜鸟求助,关于数据的查询的SQL,急求~~
- jsp向mysql提交数据乱码问题!
- 如何监测JSP网站中MYSQL数据库的查询时间啊?
- 可以在win2000下用asp访问另一台Linux机器中的PostgreSQL吗?
- 一个弱智问题,请教一下,在命令行里面怎么执行 .sql 的脚本?
- 这个是什么错误呢,设置外键时显示ERROR 1022: Can't write; duplicate key in table '#sql-434_2'
- 请教关于mysql group by性能优化的问题,请大家帮帮忙
- SQL 连表查询 请看下面内容
- 为什么不能建立库呢?请问
- 关于创建表的问题?
另外:
MySQL doesn't (yet) have database replication, but here are some info on how do to it. The most general way to replicate a database is to use the update log. See section 10.2 The update log. This requires one database that acts as a master (to which data changes are made) and one or more other databases that act as slaves. To update a slave, just run mysql < update_log. Supply host, user and password options that are appropriate for the slave database, and use the update log from the master database as input. If you never delete anything from a table, you can use a TIMESTAMP column to find out which rows have been inserted or changed in the table since the last replication (by comparing to the time when you did the replication last time) and only copy these rows to the mirror. It is possible to make a two-way updating system using both the update log (for deletes) and timestamps (on both sides). But in that case you must be able to handle conflicts when the same data have been changed in both ends. You probably want to keep the old version to help with deciding what has been updated. Because replication in this case is done with SQL statements, you should not use the following functions in statements that update the database; they may not return the same value as in the original database: DATABASE()
GET_LOCK() and RELEASE_LOCK()
RAND()
USER(), SYSTEM_USER() or SESSION_USER()
VERSION()
All time functions are safe to use, as the timestamp is sent to the mirror if needed. LAST_INSERT_ID() is also safe to use.