Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mySQL useful commands
#1
Lightbulb 
How to convert an entire mySQL database characterset and collation to UTF-8?

Set the default char sets on the database. This does not convert existing tables, it only sets the default for newly created tables.

ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_general_ci;

Convert the char set on all existing tables and their columns. This assumes that your current data is actually in the current char set. If your columns are set to one char set but your data is really stored in another then you will need to check the MySQL manual on how to handle this.

ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
Reply


Messages In This Thread
mySQL useful commands - by paia - 29.03.2020, 06:25 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)