Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Tue Jan 17, 2017 12:43 pm


Mysql Application & Query Optimization, Questions, Indexes, Bugs.

Author Message
mandrei99
Post  Post subject: Mysql drop (remove) unique key  |  Posted: Wed Jan 14, 2015 7:53 pm

Joined: Tue Aug 04, 2009 9:16 am
Posts: 245

Offline
 

Mysql drop (remove) unique key

To remove a mysql unique key, aka index it first needs to be checked.

How to check mysql unique indexes existing on a table:
Code:
mysql> SHOW INDEXES FROM my_table; 
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table    | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| my_table |          0 | id       |            1 | id          | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

Drop unique key (DROP INDEX `id` on my_table;):
Code:
mysql> DROP INDEX `id` on my_table;
Query OK, 0 rows affected (0.29 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> SHOW INDEXES FROM my_table;               
Empty set (0.00 sec)


Please make sure you have backups before running any drop/truncate commands in mysql.





Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "Mysql drop (remove) unique key"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. MySql drop unique key/index/constraint

admin

1

4429

Wed Mar 23, 2011 8:39 pm

dugEdiguift View the latest post

There are no new unread posts for this topic. Mysql add Unique index to a table column

debuser

0

911

Fri Aug 06, 2010 10:01 am

debuser View the latest post

There are no new unread posts for this topic. Mysql remove column from an existing table

debuser

0

504

Fri Aug 06, 2010 10:06 am

debuser View the latest post

There are no new unread posts for this topic. MySql doesn't start: libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)

debuser

0

878

Mon Feb 22, 2010 1:43 pm

debuser View the latest post

There are no new unread posts for this topic. Mysql: add column to table

debuser

1

1410

Fri Oct 08, 2010 1:38 am

sonee4 View the latest post

There are no new unread posts for this topic. Rename MySql table

debuser

1

388

Fri Oct 08, 2010 1:36 am

sonee4 View the latest post

There are no new unread posts for this topic. MySql rename table

admin

2

660

Mon Nov 28, 2011 3:39 am

Darwin View the latest post

There are no new unread posts for this topic. How to use a mysql stored procedure

debuser

1

359

Tue Nov 22, 2011 1:23 am

Darwin View the latest post

There are no new unread posts for this topic. Mysql: Cleaning binary logs

debuser

1

684

Tue May 18, 2010 9:45 am

designeru View the latest post

There are no new unread posts for this topic. Mysql change column's default value

debuser

0

869

Thu Aug 12, 2010 3:43 am

debuser View the latest post

 

Who is online
Users browsing this forum: No registered users and 1 guest
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO