[Solved] latin1_swedish_ci collation by default in PhpMyadmin to “utf8_general_ci”

After upgrading to PhpMyAdmin version: 3.4.5 (which comes in XAMPP 1.7.7-VC9), I noticed that the default collation of MySql is set to “latin1_swedish_ci”.Due to this, whenever a new database is created using phpMyAdmin, it sets the collation as latin1_swedish_ci by default(there will be no problem due this though). We can change this to “utf8_general_ci” / “utf8_unicode_ci” by selecting the needed one before creating the database. If we forgot to select the right one, then it will make the collation as “latin1_swedish_ci”. 🙁

Change the default collation to utf8_general_ci in MySql:

  • Open the my.ini file. (C:xamppmysqlbinmy.ini)
  • Find the text [mysqld] and add the below lines.
    [mysqld]
    character-set-server = utf8
    collation-server = utf8_general_ci

    The above two lines will select a character set and collation at server startup. These settings apply server-wide and apply as the defaults for databases created by any application, and for tables created in those databases.
  • Save the file and restart the mysql server.(XAMPP Control Panel -> Stop -> Start)


For more info read: Configuring the Character Set and Collation for Applications


Posted

in

,

by

Comments

2 responses to “[Solved] latin1_swedish_ci collation by default in PhpMyadmin to “utf8_general_ci””

  1. theboywonder Avatar

    Thanks dude. Time saver this is.

  2. Francesco Avatar
    Francesco

    What about if I don’t use XAMPP? Do you know how to do it? I have a CentOS 8 server with Apache, PHP and MariaDB but on phpmyadmin I have this problem.

    Thanks in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *