Replication and Binary Logging Options and Variables
1447
Option Sets Variable
Yes,
auto_increment_increment
[1446]
Variable Name
auto_increment_increment
Variable Scope
Global, Session
Dynamic Variable
Yes
Permitted Values
Type
numeric
Default
1
Range
1 .. 65535
auto_increment_increment
[1446]
and
auto_increment_offset
[1449]
are intended for
use with master-to-master replication, and can be used to control the operation of
AUTO_INCREMENT
columns. Both variables have global and session values, and each can assume an integer value
between 1 and 65,535 inclusive. Setting the value of either of these two variables to 0 causes its
value to be set to 1 instead. Attempting to set the value of either of these two variables to an integer
greater than 65,535 or less than 0 causes its value to be set to 65,535 instead. Attempting to set
the value of
auto_increment_increment
[1446]
or
auto_increment_offset
[1449]
to a
noninteger value gives rise to an error, and the actual value of the variable remains unchanged.
These two variables affect
AUTO_INCREMENT
column behavior as follows:
•
auto_increment_increment
[1446]
controls the interval between successive column values.
For example:
mysql>
SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
+--------------------------+-------+
2 rows in set (0.00 sec)
mysql>
CREATE TABLE autoinc1
->
(col INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
Query OK, 0 rows affected (0.04 sec)
mysql>
SET @@auto_increment_increment=10;
Query OK, 0 rows affected (0.00 sec)
mysql>
SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| auto_increment_increment | 10 |
| auto_increment_offset | 1 |
+--------------------------+-------+
2 rows in set (0.01 sec)
mysql>
INSERT INTO autoinc1 VALUES (NULL), (NULL), (NULL), (NULL);
Query OK, 4 rows affected (0.00 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql>
SELECT col FROM autoinc1;
+-----+
| col |
+-----+
| 1 |
| 11 |
| 21 |
| 31 |
+-----+
4 rows in set (0.00 sec)
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...