What will happen to existing data if I change the collation of a column in MySQL?

前端 未结 5 534
无人及你
无人及你 2021-01-12 02:37

I am running a production application with MySQL database server. I forget to set column\'s collation from latin to utf8_unicode, which results in

5条回答
  •  情歌与酒
    2021-01-12 03:33

    My question is, what will happen with my existing data if I change my collation to utf8_unicode now?

    Answer: If you change to utf8_unicode_ci, nonthing will happen to your existing data (which is already corrupt and remain corrupt till you modify it).

    Will it destroy or corrupt the existing data or will the data remain, but the new data will be saved as utf8 as it should?

    Answer: After you change to utf8_unicode_ci, existing data will not be destroyed. It will remain the same like before (something like ????). However, if you insert new data containing Unicode characters, it will be stored correctly.

    I will change with phpMyAdmin web client.

    Answer: Sure, you can change collation with phpMyAdmin by going to Operations > Table options

提交回复
热议问题