Delete/install/encode configuration file configuration of ubuntu mysql 5.6

Source: Internet
Author: User

Delete/install/encode configuration file configuration of ubuntu mysql 5.6

1. Delete MySQL

A. sudo apt-get autoremove -- purge mysql-server *

B. sudo apt-get remove mysql-server

C. sudo apt-get autoremove mysql-server

D. sudo apt-get remove mysql-common (very important)

The above is actually redundant. We recommend that you perform the deletion, installation, and encoding configuration file configuration of ubuntu mysql 5.6 in sequence.

2. Clear residual data

Dpkg-l | grep ^ rc | awk '{print $2}' | sudo xargs dpkg-P

3. Install mysql

A. sudo apt-get install mysql-server

B. sudo apt-get install mysql-client

C. sudo apt-get install php5-mysql (installation php5-mysql is to connect php and mysql)

After installation, you can start the mysql service. You can also use the following command to manage the mysql service.

Service mysql start (start mysql)

Service mysql stop (disable mysql)

Service mysql restart (restart mysql)

Run the following command to access mysql:

Mysql-u root-p 123456 (123456 sets your own password)

View Encoding

Show variables like '% character % ';

[Python] view plain copy

Mysql> show variables like 'character % ';

+ -------------------------- + ---------------------------- +

| Variable_name | Value |

+ -------------------------- + ---------------------------- +

| Character_set_client | utf8 |

| Character_set_connection | utf8 |

| Character_set_database | latin1 |

| Character_set_filesystem | binary |

| Character_set_results | utf8 |

| Character_set_server | latin1 |

| Character_set_system | utf8 |

| Character_sets_dir |/usr/share/mysql/charsets/|

+ -------------------------- + ---------------------------- +

Some latin1 encoding causes Chinese garbled characters. Modify the encoding configuration below.

Cd/etc/mysql/my. cnf)

Sudo chmod 775 my. cnf

Sudo vim my. cnf

Add the following content after the file

[Python] view plain copy

[Mysqld]

Character-set-server = utf8

ESC +: wq save and exit

Use service mysql restart to restart the mysql service.

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.