How to change default character set of database

SO has the same question 'mysql change default table charset to database charset' asked before .I used the second answer to change my database default character set to utf-8 .

alter database mydatabase default character set utf8 collate utf8_general_ci;

But when I exported the database using phpMyAdmin ,though at the top I have

/*!40101 SET NAMES utf8 */;

but for queries I have something like

-- Table structure for table `paras`

  `p_id` int(11) NOT NULL AUTO_INCREMENT,
  `para` text,
  PRIMARY KEY (`p_id`)

where charset=latin1 .IMO it shouid be set to UTF-8.Am I confusing something or what is the correct way?


In MySQL individual columns have a actual charset setting. Anything else just has a default charset setting. This means if a charset is not explicitly specified for a column, the default charset of its table is used. If there is none, the default of the database it's in is used. If there is none, the server default is used. Each one of server, database and table has an individual default setting which overrides the next higher default.

What you did was simply set the default for the database, but your tables still have individual defaults set. You'll have to change it for each individual table.


 ? mysql change default character set latin1 to utf8
 ? Cannot change mysql server collation with my.cnf
 ? Do I really need to encode '&' as '&'?
 ? Do I really need to encode '&' as '&'?
 ? Do I really need to encode '&' as '&'?
 ? Whats the difference between & and & in HTML5?
 ? Is it invalid HTML to write "&" by itself? Why?
 ? Display the & character as &
 ? Html with parameters GET
 ? What is &amp used for