Install MySQL under Linux system

Source: Internet
Author: User

First, installation reprint: http://blog.csdn.net/chenpy/article/details/50344085 1. Upgrade Apt-get

Apt-get Update

If it appears

If you are not the root user, you will need to use the sudo command

sudo apt-get update


The following permissions issues can be referenced by this method.

2. Installing mysql-client-core-5.6

Apt-get Install mysql-client-core-5.6

If it is not the root user, execute

sudo apt-get install mysql-client-core-5.6

3. Installing mysql-client-5.6

Apt-get Install mysql-client-5.6

If it is not the root user, execute

sudo apt-get install mysql-client-5.6

4. Installing mysql-server-5.6

Apt-get Install mysql-server-5.6

If it is not the root user, execute

sudo apt-get install mysql-server-5.6

5. Check if MySQL is started

<1> see if the MySQL process is running

Ps-ef | grep MySQL

<2> View MSYQL Listening ports

Netstat-tap | grep MySQL

6. MSYQL Service Stop

Service MySQL Stop

If it is not the root user, execute

sudo service MySQL stop

7. Mysql Service startup

Service MySQL Start

8. Mysql Service Restart

Service MySQL Restart

Two. Mysql Service remote Access 1: Comment binding 127.0.0.1

Vim/etc/mysql/my.cnf

Restart MSYQL

Service MySQL Restart

2. Authorizing non-native users to log in to the database

<1> Login

After you turn on the MySQL service, you can log in using the MySQL command. General use of mysql-uroot-p can be. If the database is not native, you need to add parameters, common parameters are as follows:
1,-h, specifying an IP address, localhost by default
2,-u, specify the user name.
3,-p, specify the password, the password can be followed by-p input mysql-uroot-p123456. You can also mysql-uroot-p enter the password when prompted to enter, so that the input password does not echo.
<2> Execute commands
GRANT all privileges on * * to ' root ' @ '% ' identified by ' root ' with GRANT OPTION;
FLUSH privileges;
Third, the MySQL Service side encoding method modification
1. View MySQL service-side code
Log in to MySQL, execute
Status
Discovery is latin1, need to modify the encoding method for UTF8, if not modified, the database stored in Chinese will appear garbled.
2. Modify the configuration file
Vim/etc/mysql/my.cnf
<1> append under [client]: Default-character-set=utf8
<2> added under [MySQL]: Character-set-server=utf8

<3> added under [MySQL]: Default-character-set=utf8

<4> Save exit, restart Server, execute

Service MySQL Restart

3. Re-view the MySQL server encoding method

<1> log in to MySQL, execute

Status

Install MySQL under Linux system

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.