Error changing charset using MySQL Table Editor from latin1 to utf8

0

I'm trying to change the charset from a table directly in the database using MySQL Table Editor, from latin1 to utf8 however, when I select utf8 in the charset options it automatically changes the collation to utf8mb4_general_ci and when I apply the changes it returns me the following error :

collation para utf8mb4_general_ci is not valid for character set utf8

Among the dozens of collations in the collation option which should be the correct one?

    
asked by anonymous 17.04.2017 / 13:09

1 answer

1
So the correct is the one that looks at you, so it depends on the case any one can be that correct looking, now if you are wanting to use the ABNT2 then a utf8 - default collation will resolve.

Regarding error message, so it seems you already have records in the table and these records can not (not valid) convert them to the other collation, a simple way to understand this is if you already have a character type ç and want to convert it to an American format where it does not exist, then it will generate an error.

did not ask but I'll post a coded example:

ALTER TABLE 'database'.'tabela' CHARACTER SET = utf8 ;

According to comments: php.ini file

has a snippet of code that should be commented out, or if it does not exist write

; PHP's default character set is set to empty.
; http://php.net/default-charset
;default_charset = "UTF-8"

Remove the ; character that is n beginning of the line, default_charset="UTF-8" and restart the apache service.

In the http.conf file there is also a line where a charset configuration is done:

#AddDefaultCharset utf-8

Same schema remove the first character and restart the service

    
17.04.2017 / 13:21