Axiso

Notes

Conversion de caractères spéciaux sur MySQL

Mysql — mai 2011 , ,

Si les données présentes sur une table sont enregistrées avec un encodage erroné, il est possible de rétablir les caractères spéciaux corrects avec cette suite de commandes, à défaut de mieux.

UPDATE `table` SET `column`=REPLACE(`column`,'á','á');
UPDATE `table` SET `column`=REPLACE(`column`,'ä','ä');
UPDATE `table` SET `column`=REPLACE(`column`,'â','â');
UPDATE `table` SET `column`=REPLACE(`column`,'é','é');
UPDATE `table` SET `column`=REPLACE(`column`,'è','è');
UPDATE `table` SET `column`=REPLACE(`column`,'ê','ê');
UPDATE `table` SET `column`=REPLACE(`column`,'ë','ë');
UPDATE `table` SET `column`=REPLACE(`column`,'ì','ì');
UPDATE `table` SET `column`=REPLACE(`column`,'í','í');
UPDATE `table` SET `column`=REPLACE(`column`,'î','î');
UPDATE `table` SET `column`=REPLACE(`column`,'ïo','ï');
UPDATE `table` SET `column`=REPLACE(`column`,'ò','o');
UPDATE `table` SET `column`=REPLACE(`column`,'ó','ò');
UPDATE `table` SET `column`=REPLACE(`column`,'ô','ó');
UPDATE `table` SET `column`=REPLACE(`column`,'ö','ô');
UPDATE `table` SET `column`=REPLACE(`column`,'ù','ö');
UPDATE `table` SET `column`=REPLACE(`column`,'ú','ù');
UPDATE `table` SET `column`=REPLACE(`column`,'ü','ú');
UPDATE `table` SET `column`=REPLACE(`column`,'û','ü');
UPDATE `table` SET `column`=REPLACE(`column`,'€','û');
UPDATE `table` SET `column`=REPLACE(`column`,'Ã','à');
UPDATE `table` SET `column`=REPLACE(`column`,'€','€');

Exporter une base au format SQL

Mysql — septembre 2009 ,

Export d’une base complète vers un fichier :

mysqldump -u root -p base > fichier.sql

Ajouter un utilisateur

Mysql — mars 2009 , , , ,

Création d’un nouvel utilisateur Mysql dédié à une base de données

grant all on base.* to utilisateur@localhost identified by 'passe';
flush privileges;