是否可以仅为单个数据库设置 auto_increment_offset 和 auto_increment_increment 变量而不影响任何其他数据库?
我想要这个的原因是我正在数据库上实现主主复制,但我有一个包含 30 个域及其数据库的云 VPS。所以我需要为单个数据库设置这个变量而不影响其他数据库。
最佳答案
不,它是一个全局变量。 You can set it per session不过,因此可以编写 PHP 软件来在每次打开数据库连接时设置它。
If the local value is set, the new value affects
AUTO_INCREMENT
columns for all tables into which new rows are inserted by the current user for the duration of the session, unless the values are changed during that session.
关于php - 如何为单个数据库设置auto_increment_offset和auto_increment_increment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24085336/