Complete uninstall and install configuration Character set for MySQL under Linux

Source: Internet
Author: User
Tags mysql in

Complete Uninstall and install configuration Character set for MySQL under Linux
Preface:There are many tutorials on how to install and configure MySQL in the Linux environment online. This article is written because in the configuration of the character set of the time to find some of the online tutorials found and can not be used to cause a toss for a while. The following tutorials are all in-person practice.MySQL Uninstall completelyFirst check to see if you have MySQL installed. The code is as follows:
Ps-aux|grep MySQL
No content is displayed if not installed, and the following information is displayed if installed:


There are a lot of ways to completely uninstall MySQL, manually to uninstall and delete redundant files is more troublesome, just execute the following three instructions in turn:

We must pay attention to you here. MySQL version
MySQL installation is the simplest way to install the command line, enter the code in turn:
sudo apt-get install mysql-serversudo apt-get Install Mysql-client

You will be prompted to set the root password when you install the server.

Configuration of MySQL character set first we open MySQL on the terminal:
Mysql-uroot-p

Then enter the password to enter MySQL

We then enter the following query statement to see the default character Set settings:
Show variables like '%character% ';

We'll look at the results:

We can see that our character_set_database and character_set_server two have not yet been set to UTF8 (or GBK). Below we only need to modify the configuration file in MySQL. After exiting MySQL, enter the following code to edit the configuration file at the command line:
sudo vim/etc/mysql/my.cnf
If Vim is not installed, it can be opened with the gedit of the system:
sudo gedit/etc/mysql/my.cnf

The following only needs to be modified in two places! But be aware mysql5.5 The following versionsAnd 5.5 or laterThere is a difference, be sure to pay attention to their own version! mysql5.5 The following versionsModify the following: " Client】default-character-set = UTF8" mysqld" default-character-set = UTF8
mysql5.5 or laterModify the following: " Client】default-character-set = UTF8" mysqld"character-set-server = UTF8



Next Restart MySQLMake the configuration file effective: There are two ways: Mode 1:
Sudo/etc/init.d/mysql restart
Mode 2:
sudo service MySQL restart


Next go to MySQL, and then look at the character set settings:

Can see Other than systemIt's all for UTF8. Note database created before changing the character setThe data is still garbled in Chinese, then we can back up the data to create a new.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Complete uninstall and install configuration Character set for MySQL under Linux

Related Article

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.