How to remove accents in MySQL?
If you set an appropriate collation for the column then the value within the field will compare equal to its unaccented equivalent naturally.
mysql> SET NAMES 'utf8' COLLATE 'utf8_unicode_ci';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT 'é' = 'e';
+------------+
| 'é' = 'e' |
+------------+
| 1 |
+------------+
1 row in set (0.05 sec)
I had the same problem, so I wrote a list of querys based on a PHP script I have to remove accents and make SEO friendly URLs:
Maybe you would like to add other special characters, such as the $
or £
symbols...
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å ','S');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å¡','s');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','Dj');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ž','Z');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ž','z');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã
','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','C');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','E');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','E');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','E');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','E');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','I');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','I');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','I');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','I');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','N');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','U');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','U');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','U');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','U');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','Y');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','B');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','Ss');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã ','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'á','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'â','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ã','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ä','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã¥','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'æ','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ç','c');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'è','e');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'é','e');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ê','e');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ë','e');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ì','i');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','i');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'î','i');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ï','i');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ð','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ñ','n');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ò','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ó','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ô','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'õ','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ö','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ø','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ù','u');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ú','u');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'û','u');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ý','y');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ý','y');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'þ','b');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ÿ','y');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Æ','f');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'.',' ');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,' ','-');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'--','-');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ä','e');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ž','z');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å¡','s');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ä','c');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å','r');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ä','d');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å¥','t');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å','n');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ů','u');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ä','E');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ž','Z');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å ','S');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ä','C');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å','R');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ä','D');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ť','T');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å','N');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å®','U');
UPDATE TABLE_NAME SET COLUMN = LOWER(COLUMN);