As you have already created the database you will have a slightly bigger job, do the following:
Change the database encoding:
ALTER DATABASE <nome_do_banco> CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Changing the encoding of tables:
ALTER TABLE <nome_da_tabela> CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Changing the encoding of columns:
ALTER TABLE <nome_da_tabela> MODIFY <nome_da_coluna> <VARCHAR(255)> CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Or you can run these queries down to facilitate your work by having to go through the entire bank.
SELECT DISTINCT concat('ALTER DATABASE ', TABLE_SCHEMA, ' CHARACTER SET utf8 COLLATE utf8_unicode_ci;')
from information_schema.tables
where TABLE_SCHEMA like 'database_name';
--
SELECT concat('ALTER TABLE ', TABLE_SCHEMA, '.', table_name, ' CHARACTER SET utf8 COLLATE utf8_unicode_ci;')
from information_schema.tables
where TABLE_SCHEMA like 'database_name';
--
SELECT concat('ALTER TABLE ', t1.TABLE_SCHEMA, '.', t1.table_name, ' MODIFY ', t1.column_name, ' ', t1.data_type , '(' , CHARACTER_MAXIMUM_LENGTH , ')' , ' CHARACTER SET utf8 COLLATE utf8_unicode_ci;')
from information_schema.columns t1
where t1.TABLE_SCHEMA like 'database_name' and CHARACTER_SET_NAME = ‘old_charset_name';
I tried to put chaset in php and still did nothing. I didn’t understand was the part of the database. She’s already a maid, but I have to raise her again ?
– Odacil
No need to recreate the bank, it will only cost you a little more work.
– Thiago Augustus Oliveira