Forked from fernandoaleman/converting-mysql-database-contents-to-utf8
Created
April 25, 2016 19:26
-
-
Save MarceloPedra/6b9c929bd985dc3fe04adebac6218c78 to your computer and use it in GitHub Desktop.
Converting MySQL Database Contents to UTF-8
This file contains 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