Complete uninstall and install configuration Character set for MySQL under Linux

Source: Internet
Author: User
Tags mysql version

Objective:

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 completely

First check to see if you have MySQL installed. The code is as follows:

1 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:

Be sure to pay attention to your MySQL version here!

installation of MySQL

The simplest way to install is the command line, enter the code in turn:

1 sudo apt-get install mysql-server2 3 sudo apt-get install mysql-client

Configuration of the MySQL character set

First we open MySQL on the terminal:

1 mysql-uroot-p

Then enter the password to enter MySQL

We then enter the following query statement to see the default character Set settings:

1 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:
1 sudo vim/etc/mysql/my.cnf

If Vim is not installed, it can be opened with the gedit of the system:

1 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" mysqlddefault-character-set = UTF8 mysql5.5 or laterModify the following: " Client"Default-character-set = UTF8" mysqldcharacter-set-server = UTF8 Next Restart MySQLMake the configuration file effective: There are two ways: Mode 1:
1 sudo/etc/init.d/mysql Restart

Mode 2:

1 sudo service MySQL restart

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

You can see that in addition to the system , this is for UTF8.

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.