Compile and install mysql 5.6.21 and centos5.6.21 in Centos

Source: Internet
Author: User

Compile and install mysql 5.6.21 and centos5.6.21 in Centos

1. install various dependent packages in yum

[Root @ WebServer ~] # Yum-y install gcc-devel gcc-c ++-devel autoconf * automake * zlib * libxml * ncurses-devel ncurses libgcrypt * libtool * cmake openssl -devel bison-devel unzip

2. Create the 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 permission to your current user (my user name is mysql)

Chown mysql. mysql/opt/mysql

Chown mysql. mysql/opt/mysql/data-

4.decompress the mysql-5.6.21.tar.gz source code package

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

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

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

5.download gmock-1.6.0.zip and decompress 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. Compile and install

Cmake \-DCMAKE_INSTALL_PREFIX =/opt/mysql \-DMYSQL_DATADIR =/opt/mysql/database \-region = 1 \-DWITH_INNOBASE_STORAGE_ENGINE = 1 \-region = 1 \-region = 1 \ -Metadata = 1 \-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \-DWITH_READLINE = 1 \-DENABLE_DOWNLOADS = 1 \-DENABLED_LOCAL_INFILE = 1 \-DMYSQL_UNIX_ADDR =/var/lib/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

[Root @ master 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. initialize the database

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

9. Create shell scripts for MySQL Database Management
Root @ master support-files] # cp mysql. server/etc/init. d/mysql

[Root @ master support-files] # chmod + x/etc/init. d/mysql

[Root @ master support-files] # service mysql start

Starting MySQL .. [OK]

[Root @ master support-files] #

 

10. Set the password of the MySQL root User

/Opt/msql/bin/mysqladmin-u root password 123123 # change the root account password of the mysql database to 123123


11. log on to mysql

[Root @ master support-files] # mysql-uroot-p123123

Warning: Using a password on the command line interface can be 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) 2000,201 4, Oracle and/or its affiliates. All rights reserved.

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

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.

Welcome to my personal website

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.