CentOS Installation mysql5.6.16

Source: Internet
Author: User
Tags mysql commands

1 installation package Download
mysql5.6:

http://dev.mysql.com/downloads/mysql/

2 installation of MySQL
RPM64-bit installation packages downloaded from the official website:

Mysql-5.6.16-1.linux_glibc2.5.x86_64.rpm-bundle.tar,

(1) Use the command:

Tar xvf Mysql-5.6.16-1.linux_glibc2.5.x86_64.rpm-bundle.tar

Unzip it, the extracted file directory is:

650) this.width=650; "src=" http://www.linuxidc.com/upload/2014_02/140228064764891.jpg "width=" 581 "vspace=" 5 "style = "border:0px;margin:0px;padding:0px;"/>

Look at the file name in general know what each package is for, no longer explain.

(2) Check if MySQL is installed on the system, using the command:

#rpm-qa | grep MySQL

To uninstall the installed MySQL, uninstall the MySQL command as follows:

#rpm-E--nodeps mysql-libs-5.1.61-4.el6.x86_64

Remove all files under the/var/lib/mysql folder cleanly.

(3) Install the server and client using the following command:

RPM-IVH mysql-server-5.6.16-1.linux_glibc2.5.x86_64.rpm

RPM-IVH mysql-client-5.6.16-1.linux_glibc2.5.x86_64.rpm

(4) Use the following command to view the current MySQL status:

Service MySQL Status

If you are running, you are prompted:

650) this.width=650; "src=" http://www.linuxidc.com/upload/2014_02/140228064764892.jpg "style=" border:0px;margin:0 px;padding:0px; "/>

(5) If it is not running, start with the following command:

Service MySQL Start

You can add the start command to the Linux startup item and start the MySQL service with the following command:

Chkconfig--add MySQL

Chkconfig MySQL on

With the command chkconfig–-list view, this action is root.

(6) To set the root password for MySQL, use the following command:

Mysql-u root-p

will prompt for a password, the initial root password is saved in the '/root/.mysql_secret ' file

then enter Mysql>set PASSWORD = PASSWORD (' 123456 ');

(7) After landing enter, a command to look at the effect:

650) this.width=650; "src=" http://www.linuxidc.com/upload/2014_02/140228064764893.jpg "width=" 581 "vspace=" 5 "style = "border:0px;margin:0px;padding:0px;"/>

Here are the three main directories and their features after MySQL installation:

/var/lib/mysql Database files

/usr/share/mysql commands and configuration files

/usr/bin Mysqladmin, mysqldump and other commands

(8) allow root to connect remotely

Grant all privileges on * * to ' root ' @ '% ' with GRANT option;


Third, modify the code

1, check the current database encoding: Show VARIABLES like ' character% ';

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/52/74/wKioL1RkdCHBFBPPAAGVOAF8mRw778.jpg "title=" 1.png " alt= "Wkiol1rkdchbfbppaagvoaf8mrw778.jpg"/>

The default character set for Character_set_database and Character_set_server is still latin1.

2, the simplest perfect modification method, modify the MySQLmy.cnfCharacter set key values in the file ( note the field details of the configuration ):

(1) Add Default-character-set=utf8 to the [client] field as follows:

[Client]
Port = 3306
Socket =/var/lib/mysql/mysql.sock
Default-character-set=utf8

(2) Add character-set-to the [mysqld] fieldServer=utf8, as follows:

[mysqld]
Port = 3306
socket =/var/lib/mysql/mysql.sock
character-set-server=utf8

(3) Add Default-character-set=utf8 to the [MySQL] field as follows:
[mysql]
no-auto-rehash
DEFAULT-CHARACTER-SET=UTF8

3, after the modification is complete, Service MySQL Restart restart the MySQL services to take effect. Note: The [mysqld] field differs from the [MySQL] field. This is no one on the internet feedback.

use show VARIABLES like ' character% '; view, Discover Database The code has been changed to UTF8.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/52/76/wKiom1Rkcxmgd9j6AAF2U81Xoa8636.jpg "title=" 2.png " alt= "Wkiom1rkcxmgd9j6aaf2u81xoa8636.jpg"/>


CentOS Installation mysql5.6.16

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.