How to delete all rows which contains a specific value or character in a mysql database table

On my last posts I had crawled a lot of domain name on a mysql table. And now there is a new problem with specific characters like “:” and port numbers.

For example:

Now I want to delete all this domain names which contains the port numbers in field “url”.

MySQL command for find and delete the rows with sql-query.

DELETE FROM urls where url LIKE '%:%';


mysql> DELETE FROM urls where url like '%:%';
Query OK, 1493450 rows affected (2 min 37,65 sec)

other methods:

Leave a Comment