Change the MySQL encoding format from latin1 to UTF8 under Mac

Source: Internet
Author: User

Since MySQL's default encoding is latin1, it is necessary to modify its default encoding format to modify its configuration file.

However, most of the tutorials on the web say that you should copy the Xxx.cnf file under/usr/local/mysql/support-files/to/etc folder and name it my.cnf, and then change the encoding by modifying the MY.CNF configuration file. Most of the way, of course, it works, but it doesn't work on my Mac, and here's how I change it:

1. Directly in the fate of the line through the sudo vi/etc/local/mysql file name/my.cnf, that is, modify the installation directory my.cnf, without the need to copy to/etc path, because at the time of installation, there is no ETC path generates a file similar to MY.CNF, which means that the file under this path is not used when the configuration is read

2. Move the cursor behind [mysqld] and add 3 properties

Default-storage-engine=innodb

Character-set-server=utf8

Collation-server=utf8_general_ci

3. Press the ESC key in the upper-left corner of the keyboard to eject edit mode and enter a colon and letter Wq

4. Restart MySQL service it's that simple.

Change the MySQL encoding format from latin1 to UTF8 under Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.