Question

Why I can't remove field from MySQL Database¿?

mysql> describe Clients;

+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int(11)      | NO   | PRI | NULL    | auto_increment |
| name        | varchar(255) | NO   |     | NULL    |                |
| shurname    | varchar(255) | NO   |     | NULL    |                |
| email       | varchar(255) | NO   |     | NULL    |                |
| password    | varchar(255) | NO   |     | NULL    |                |
| userId      | int(11)      | NO   |     | NULL    |                |
| userMessage | varchar(255) | YES  |     | NULL    |                |
| userName    | varchar(255) | YES  |     | NULL    |                |
| pwd         | varchar(255) | YES  |     | NULL    |                |
| surname     | varchar(255) | YES  |     | NULL    |                |
+-------------+--------------+------+-----+---------+----------------+
10 rows in set (0.00 sec)

mysql> ALTER TABLE Clients DROP userId;
^CCtrl-C -- sending "KILL QUERY 104" to server ...
Ctrl-C -- query aborted.
ERROR 1317 (70100): Query execution was interrupted
mysql> ALTER TABLE Clients DROP userMessage;

And it doesn't finish, it get stuck and don't delete.... I want to delete userId, userMessage, userName, pwd and surname.

Was it helpful?

Solution 2

I cannot even drop the table being root:

mysql> show tables;
+-------------------------+
| Tables_in_Hoteles_Compu |
+-------------------------+
| Clients                 |
| Coords                  |
| Hotels                  |
| Rate                    |
| Regions                 |
+-------------------------+
5 rows in set (0.00 sec)

mysql> drop table Coords;
Query OK, 0 rows affected (0.04 sec)

mysql> drop table Clients;

OTHER TIPS

If you first remove the autoincrement and drop the primary key you should be able to delete the field. Maybe even just removing the autoincrement would do it but not sure. The other fields should delete ok regardless.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top