Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change default collation in phpmyadmin

It seems to me that phpMyAdmin imports tables by default with collation latin1_swedish_ci, how i change this?

like image 993
Sergio del Amo Avatar asked Sep 30 '08 15:09

Sergio del Amo


People also ask

How do I change the default collation of a database?

You can change the collation of any new objects that are created in a user database by using the COLLATE clause of the ALTER DATABASE statement. This statement does not change the collation of the columns in any existing user-defined tables. These can be changed by using the COLLATE clause of ALTER TABLE.

What is MySQL default collation?

The default MySQL server character set and collation are latin1 and latin1_swedish_ci , but you can specify character sets at the server, database, table, column, and string literal levels.

What is default PhpMyAdmin database?

PHPmyAdmin is installed but it has a bunch of databases installed as default. •cdcol (1) •information_schema (37) •mysql (24) •performance_schema (17) •phpmyadmin (8) •test •webauth (1)

How do I change the default character set in MySQL?

The MySQL server has a compiled-in default character set and collation. To change these defaults, use the --character-set-server and --collation-server options when you start the server.


2 Answers

In your Mysql configuration change the default-character-set operative under the [mysqld] tab. For example:

[mysqld] default-character-set=utf8 

Don't forget to restart your Mysql server afterwards for the changes to take effect.

like image 194
Eran Galperin Avatar answered Oct 12 '22 22:10

Eran Galperin


For Linux:

  1. You need to have access to the MySQL config file.
    The location can vary from /etc/mysql/my.cnf to ~/my.cnf (user directory).

  2. Add the following lines in the section [mysqld]:

    collation_server = utf8_unicode_ci character_set_server=utf8 
  3. Restart the server:

    service mysqld restart 
like image 36
Yasen Avatar answered Oct 13 '22 00:10

Yasen