Remove a mysql column configuration

Asked

Viewed 82 times

0

I have a mysql column that has a key worthwhile MUL, how to remove this setting from the command line?

My table has the following scheme:

+-----------------+--------------+------+-----+-------------------+-----------------------------+
| Field           | Type         | Null | Key | Default           | Extra                       |
+-----------------+--------------+------+-----+-------------------+-----------------------------+
| imovel_id       | int(11)      | NO   | PRI | NULL              | auto_increment              |
| user_id         | int(11)      | NO   |     | NULL              |                             |
| img_dest        | varchar(111) | YES  |     | NULL              |                             |
| data_imob       | timestamp    | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| finalidade_imob | varchar(51)  | NO   | MUL | NULL              |                             |
| status_imob     | varchar(51)  | NO   |     | NULL              |                             |
| tipo_imob       | varchar(255) | YES  |     | NULL              |                             |
| uf_imob         | varchar(51)  | NO   | MUL | NULL              |                             |
| cidade_imob     | varchar(255) | NO   |     | NULL              |                             |
| bairro_imob     | varchar(255) | YES  |     | NULL              |                             |
| rua_imob        | varchar(255) | YES  |     | NULL              |                             |
| vaga_imob       | varchar(255) | YES  |     | NULL              |                             |
| dorms_imob      | char(2)      | YES  |     | NULL              |                             |
| tamanho_imob    | varchar(222) | YES  |     | NULL              |                             |
| valor_imob      | varchar(255) | YES  |     | 0                 |                             |
| titulo_imob     | varchar(255) | YES  |     | NULL              |                             |
| descricao_imob  | longtext     | YES  |     | NULL              |                             |
| carac_imob      | varchar(255) | YES  |     | NULL              |                             |
+-----------------+--------------+------+-----+-------------------+-----------------------------+

1 answer

1


Just run an alter table, and drop the index from your table:

ALTER TABLE [nome_tabela] DROP INDEX [nome_index];

  • Thank you for your attention, I am new to mysql, which would be this name_index?

  • the name of the index that the column has that would be your "key" that you specified above

  • I edited my question for you to have a basis of how is my table I would like to take the column setting uf_imob, I’m not getting through.

  • perform a SHOW CREATE TABLE, and check the Key name for the value, then run the above command. anything put in the answer the CREATE TABLE hers please:

  • the MUL only means that it is an index that is not Unique, it is multiple. its name you will be able to see in CREATE TABLE ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.