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?
Syntax for MySQLMySQL uses the AUTO_INCREMENT keyword to perform an auto-increment feature. By default, the starting value for AUTO_INCREMENT is 1, and it will increment by 1 for each new record. VALUES ('Lars','Monsen'); The SQL statement above would insert a new record into the "Persons" table.
AutoIncrement fields are integer in mysql. You can mirror the auto-increment field in a varchar field and create a trigger which updates the varchar field on insert/update.
MySQL has the AUTO_INCREMENT keyword to perform auto-increment. The starting value for AUTO_INCREMENT is 1, which is the default. It will get increment by 1 for each new record. To get the next auto increment id in MySQL, we can use the function last_insert_id() from MySQL or auto_increment with SELECT.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With