Centos compilation install MySQL 5.6.21

Source: Internet
Author: User
Tags openssl

1.yum installing each dependent package

[Email protected] ~]# yum-y install gcc gcc-devel gcc-c++ gcc-c++-devel autoconf* automake* zlib* libxml* ncurses-devel ncurses libgcrypt* libtool* cmake OpenSSL openssl-devel Bison bison-devel Unzip

2. Create MySQL installation directory and database directory

Mkdir-p/opt/mysql/data

Mkdir-p/opt/mysql/etc

Mkdir-p/opt/mysql/log

3. Change the MySQL directory permissions for your current user (my username is MySQL)

Chown Mysql.mysql/opt/mysql

Chown Mysql.mysql/opt/mysql/data-

4. Unzip the mysql-5.6.21.tar.gz source package

Tar zxvf ~/Download/mysql-5.6.21.tar.gz-c/usr/local/src/

Chown mysql.mysql/usr/share/src/mysql-5.6.21

Hown mysql.mysql/usr/share/src/mysql-5.6.21/-R

5. Download the Gmock-1.6.0.zip and extract it to the Source_downloads directory in the source code.

Http://bbs.ithome.com/forum.php?mod=attachment&aid=NTk1MjYwfGNkYzNjZDM0fDE0MTM4NTU1MzR8MjA5NDI5Nnw2Mzg1NTA %3d

Unzip ~/Download/gmock-1.6.0.zip

MV gmock-1.6.0/usr/local/src/mysql-5.6.21/source_downloads/

cd/usr/local/src/mysql-5.6.21/source_downloads/gmock-1.6.0

./configure

Make

Cd.. /.. /

6. Compiling the installation

CMake \-dcmake_install_prefix=/opt/mysql \-dmysql_datadir=/opt/mysql/database \-dwith_myisam_storage_engine=1 \- dwith_innobase_storage_engine=1 \-dwith_memory_storage_engine=1 \-dwith_archive_storage_engine=1 \-DWITH_ partition_storage_engine=1 \-dwith_blackhole_storage_engine=1 \-dwith_readline=1 \-DENABLE_DOWNLOADS=1 \-DENABLED_ local_infile=1 \-dmysql_unix_addr=/var/lib/mysql/mysql.sock \-dmysql_tcp_port=3306 \-DEXTRA_CHARSETS=all \- Ddefault_charset=utf8 \-ddefault_collation=utf8_general_ci

Make

Make install

7. Create a configuration file

Cp/opt/mysql/support-files/my-default.cnf/opt/mysql/etc/my.cnf

[Email protected] support-files]# CAT/OPT/MYSQL/ETC/MY.CNF

[Mysqld]

DataDir =/opt/mysql

DataDir =/opt/mysql/data

#socket =/tmp/mysql.sock

Socket =/opt/mysql/data/mysql.sock

#log =/opt/mysql/log/mysql.log

Pid-file =/opt/mysql/data/mysql.pid

user = MySQL

Port = 3306

#tmpdir =/tmp

Log-error =/opt/mysql/log/mysql.err

[Client]

Socket =/opt/mysql/data/mysql.sock

8. Initializing the database

/opt/mysql/scripts/mysql_install_db--user=mysql--basedir=/opt/mysql--datadir=/opt/mysql/data

9. Create a shell script that manages the MySQL database
[email protected] support-files]# CP Mysql.server/etc/init.d/mysql

[Email protected] support-files]# chmod +x/etc/init.d/mysql

[[Email protected] support-files]# service MySQL start

Starting MySQL. Determine

[Email protected] support-files]#

10. Set the MySQL root user's password

/opt/msql/bin/mysqladmin-u Root Password 123123 #修改mysql数据库的root账户密码是123123


11. Log in to MySQL

[Email protected] support-files]# mysql-uroot-p123123

Warning:using a password on the command line interface can is insecure.

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 1

Server version:5.6.21 Source Distribution

Copyright (c), the Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Welcome everyone to visit my personal website Meng Meng's IT People

Centos compilation install MySQL 5.6.21

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.