问题
I am using Windows Azure with clearDB. Current database auto-increment value is 10. I want it as 1.
I tried to run these commands in PHPMyAdmin with,
1)
set global auto_increment_increment = 1;
set global auto_increment_offset = 1;
ERROR: #1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation
2)
set auto_increment_increment = 1;
set auto_increment_offset = 1;
After that I checked it by this command,
SHOW VARIABLES LIKE 'auto_inc%';
RESULT:
Variable_name Value
auto_increment_increment 10
auto_increment_offset 1
What could be the reason?
回答1:
When I submitted ticket to clearDB, They replied me like this:
ClearDB uses circular replication to provide master-master MySQL support. As such, certain things such as auto_increment keys (or sequences) must be configured in order for one master not to use the same key as the other, in all cases. We do this by configuring MySQL to skip certain keys, and by enforcing MySQL to use a specific offset for each key used. The reason why we use a value of 10 instead of 2 is for future development.
来源:https://stackoverflow.com/questions/26002784/auto-increment-by-1-in-mysql-with-cleardb