Remplacer Charset
SELECT concat(« ALTER DATABASE ` »,table_schema, »` CHARACTER SET = utf8 COLLATE = utf8_unicode_ci; ») as _sql FROM INFORMATION_SCHEMA.`TABLES` where table_schema like « YOURDBNAME » group by table_schema;
SELECT concat(« ALTER TABLE ` »,table_schema, »`.` »,table_name, »` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci; ») as _sql FROM INFORMATION_SCHEMA.`TABLES` where table_schema like « YOURDBNAME » group by table_schema, table_name;
SELECT concat(« ALTER TABLE ` »,table_schema, »`.` »,table_name, « ` CHANGE ` »,column_name, »` ` »,column_name, »` « ,data_type, »(« ,character_maximum_length, ») CHARACTER SET utf8 COLLATE utf8_unicode_ci; ») as _sql FROM `COLUMNS` where table_schema like « YOURDBNAME » and data_type in (‘varchar’);
SELECT concat(« ALTER TABLE ` »,table_schema, »`.` »,table_name, « ` CHANGE ` »,column_name, »` ` »,column_name, »` « ,data_type, » CHARACTER SET utf8 COLLATE utf8_unicode_ci; ») as _sql FROM INFORMATION_SCHEMA.`COLUMNS` where table_schema like « YOURDBNAME » and data_type in (‘text’,’tinytext’,’mediumtext’,’longtext’,’char’);
Replace all occurences of « YOURDBNAME » with the database you want to convert. Then run the generated requests
Remplacer URL
UPDATE pb_options SET option_value = replace(option_value, ‘OLD_URL’, ‘NEW_URL’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE pb_options SET option_value = replace(option_value, ‘/ancien/dossier/racine’, ‘/nouveau/dossier/racine’);
UPDATE pb_posts SET post_content = replace(post_content, ‘OLD_URL’, ‘NEW_URL’);
UPDATE pb_posts SET guid = replace(guid, ‘OLD_URL’, ‘NEW_URL’);
UPDATE pb_postmeta SET meta_value = replace(meta_value,’OLD_URL’,’NEW_URL’);
UPDATE pb_usermeta SET meta_value = replace(meta_value, ‘OLD_URL’,’NEW_URL’);
UPDATE pb_links SET link_url = replace(link_url, ‘OLD_URL’,’NEW_URL’);
UPDATE pb_comments SET comment_content = replace(comment_content , ‘OLD_URL’,’NEW_URL’);