- 1). Open the terminal on your computer if the database is local, otherwise log in via the secure shell (SSH).
- 2). Type "mysqldump --user=USERNAME --password=PASSWORD --default-character-set-=latin1 --skip-set-charset DBNAME > BACKUP.sql" (without quotation marks).
- 3). Replace all capitalized letters so they are relevant for your database and press "Enter."
- 4). Type "chgrep latin1 utf8 BACKUP.sql" and press "Enter."
- 5). Type "mysql --user=USERNAME --pasword=PASSWORD --execute="DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE ut8_general_ci;" (replacing the USERNAME, PASSWORD and both dbname's). Press "Enter."
- 6). Type "mysql --user=USERNAME --password=PASSWORD --default-character-set=utf8 dbname < BACKUP.sql" and press "Enter."
- 7). Type in the following code and press "Enter" to complete the process:
sed -i "" 's/latin1/utf8/g' BACKUP.sql
SHARE