Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

delete all record from table in mysql [closed]

Tags:

mysql

I am trying to delete all records from a table. My query is:

delete from tableName. 

But it reports the following error:

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor -> Query Editor and reconnect."

How do I resolve this?

like image 919
Sami Avatar asked Nov 11 '11 07:11

Sami


People also ask

How do I delete a lot of rows in MySQL?

We can use DELETE statement along with a WHERE clause, which identifies those multiple rows, to delete multiple rows from MySQL table.

Is deletion possible in MySQL?

The Delete query in MySQL can delete more than one row from a table in a single query. This proves to be advantages when removing large numbers of rows from a database table. Once a Delete row in MySQL row has been deleted, it cannot be recovered.


1 Answers

truncate tableName

That is what you are looking for.

Truncate will delete all records in the table, emptying it.

like image 199
Thirler Avatar answered Oct 04 '22 17:10

Thirler