Another easy way to convert database from Latin1 to UTF8
I tried another way by searching some articles on vbulletin but it takes me long time, many steps, and not success... I found another way to do. I hope that my experiment can help someone is running a vbulletin for a long time with latin1, and now he want to convert to utf8.
After trying by myself offline some ways to convert database from latin1 to utf8, I see that there is a simple way: less steps and really easy, and no need special tool: iconv-chunk (if the database file is too big), uconv (database tools)... First of all. Turn off your vbulletin board. And turn off httpd/apache service to dedicate all resources for database converting. Next step: change mysql database server configuration. Because the default of mysql database server is running at latin1 charset. So we need to change it to UTF8 by modify my.cnf and input more settings: Code:
default-character-set = utf8 Next step: dump the old database to file. Code:
mysqldump -u dbuser -p --opt --skip-set-charset --default-character-set=latin1 database > yourboard.sql Next step: change charset from latin1 to utf8 in your dump file. Code:
perl -i -pe 's/DEFAULT CHARSET=latin1/DEFAULT CHARSET=utf8' yourboard.sql Code:
mysql --user=dbuser -p --execute="CREATE DATABASE new_database_name CHARACTER SET utf8 COLLATE utf8_general_ci;" Next step: import to new database. Code:
mysql -u dbuser -p new_database_name < yourboard.sql Modify the new database to connect to in config.php. And if you are using mysqli, go to the bottom of your config, you will see one line to un-comment. That's all. I did by myself for my board with more than 100.000 members and 1.000.000 posts. Goodluck! And remember that you should keep the original database for rescure if you do something wrong. Quynh H Nguyen |
I'll try it for my forum too. Thanks.
|
What about the language encoding setting in vBulletin ? Did you change that too?
P.S. I think you forgot the third slash here: Code:
perl -i -pe 's/DEFAULT CHARSET=latin1/DEFAULT CHARSET=utf8' yourboard.sql Code:
Substitution replacement not terminated at -e line 1. Code:
perl -i -pe 's/DEFAULT CHARSET=latin1/DEFAULT CHARSET=utf8/' yourboard.sql |
Ηello...
I have the same problem but I have my own server and I can not make this change. There are other ways;; |
All times are GMT. The time now is 09:17 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|