Portál AbcLinuxu, 12. listopadu 2025 14:49
1. Make database-backup using mysqldump:
mysqldump -u user -p database > backupfile.sql
2. Drop the extisting database
3. Create new database
4. Be sure this new empty database is utf8. E.g. execute:
ALTER DATABASE databasename DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
5. Modify the backupfile:
1. Change charset to utf8, for example by using the external tool recode:
RECODE latin1...utf8 backupfile.sql
2. Change all the "crate table" statements in this dumpfile. You have to replace "CHARSET=latin1" with "CHARSET=utf8". This can be done by using the commandline-tool sed:
sed 's/CHARSET=latin1/CHARSET=utf8/' backupfile.sql > backupfile_utf8.sql
6. Insert the changed databasedump:
mysql -u user -p database < backupfile_utf8.sql
Tiez som moc neuspel :(
MySQL_Query( "SET CHARACTER SET utf8" );
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.