Removal of table primary key in MySQL
I've removed the primary key of one table of my MySQL database, but now, when I use the MySQL Administrator and try to edit some data of this table, it doesn't allow me to do this.
The button e开发者_JAVA技巧dit that appears in the bottom of the table keeps visible, but disabled to click.
The "edit" button in MySQL Administrator will use the primary key to determine the query to run. For example - UPDATE some_field FROM some_table WHERE id = uid;
If you'd like to continue using the "edit" button, you'll have to add back a primary key. If a primary key is not appropriate you can also update your rows using the UPDATE
query.
That's likely because it doesn't know which row you want to have the update applied to, since without a primary key identifier it could match multiple lines.
Try this:
alter table tableX add primary key(id);
Replace id with your primary key column(s).
精彩评论