Posted by Singer Wang on Mar 1, 2010
I recently granted ALTER access in MySQL so a user could run the ALTER TABLE command . However after I granted the necessary privileges, the user was still not able to perform the tasks needed. Reproducing the issue using a test instance, I granted a test user the required privileges and MySQL reported no errors or warnings when the ALTER TABLE was run:
Read the rest of this entry . . .
Posted by Augusto Bott on Dec 29, 2008
The other day, a client mentioned they were getting strange results when running ALTER TABLE. The episode involved modifying an existing primary key to add an auto_increment primary key: it was “shifting” values. Say what?!
As it turns out, it was a very special value getting changed: zero. Some fiddling revealed the underlying reason. Care to join me?
To understand what’s going on, follow the example below as we start with an empty database, create a table and insert a few rows:
mysql> use test;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> create table test_table (id int not null primary key) engine=innodb;
Query OK, 0 rows affected (0.01 sec)
mysql> desc test_table;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | NO | PRI | | |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)
mysql> insert into test_table (id) values (1);
Query OK, 1 row affected (0.00 sec)
mysql> insert into test_table (id) values (2);
Query OK, 1 row affected (0.00 sec)
mysql> insert into test_table (id) values (0);
Query OK, 1 row affected (0.00 sec)
mysql> select * from test_table;
+----+
| id |
+----+
| 0 |
| 1 |
| 2 |
+----+
3 rows in set (0.00 sec)
mysql>
Now let’s change our PK and make it auto_increment Read the rest of this entry . . .
Posted by Sheeri Cabral on Aug 10, 2008
In two words: online operations. In a paragraph: Forget partitioning, row-based replication and events. The big reasons most people are going to salivate over 5.1, and probably start plans to upgrade now, are the online operations: