Forked from fernandoaleman/converting-mysql-database-contents-to-utf8
Created
April 15, 2016 10:53
-
-
Save nixjobin/fa9a1bfdcbf734a28cf00596a0e5041f to your computer and use it in GitHub Desktop.
Converting MySQL Database Contents to UTF-8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First create a dump of your MySQL database | |
mysqldump -u [user] -p database_name > database_name.sql | |
# Convert the data | |
iconv -f iso-8859-15 -t utf8 database_name.sql > database_name_iconv.sql | |
# Import the database | |
mysql -u [user] -p database_name < database_name_iconv.sql | |
# If you still have some specific characters that do not display | |
# correctly, you can update them individually. | |
# This is an example of updating a single quote | |
UPDATE `table_name` SET `column_name` = REPLACE(column_name, 'â', '’'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment