Linux RedHat 6.4 MySQL5.6 Source Package Installation

Source: Internet
Author: User

First, the preparatory work:

1, query the system installed MySQL related software package

[[email protected] ~]# rpm-qa|grep-i MySQL

2. If MySQL is turned on, stop running MySQL server

[[Email protected] ~] #service mysqld Stop

3. Uninstalling the System Package

[Email protected] ~]# rpm-e perl-dbd-mysql-4.013-3.el6.x86_64--nodeps

[Email protected] ~]# rpm-e mysql-libs-5.1.66-2.el6_3.x86_64--nodeps

[Email protected] ~]# rpm-e qt-mysql-4.6.2-25.el6.x86_64--nodeps

II. Installation and compilation

1. mysql compilation dependency

(1), necessary packages and tools

gcc/g++: MySQL 5.6 starts and needs to be compiled with g++.

Starting with Cmake:mysql 5.5, CMake is used for project management, and CMake requires more than 2.8 versions.

The BISON:MYSQL syntax parser needs to be compiled with bison.

Ncurses-devel: A development package for terminal operations.

Zlib:mysql is compressed using zlib.

(2), function needs of the package

Libxml: Support for XML input and output methods.

OpenSSL: Use the OpenSSL Secure Sockets method to communicate.

DTrace: Used to diagnose MySQL problems.

2. mysql Basic compilation parameters

CMake parameter Description Manual reference:

--cmake_build_type//Compiled version type: Relwithdebinfo and debug, the difference is that Relwithdebinfo will be optimized.

--cmake_install_prefix//Specify the target path of make install installation.

--sysconfdir//Specifies the default path for the configuration file.

--mysql_datadir//Specifies the default path for the data directory.

--with_debug//Specify whether there is debugging information, generally used for source debugging, open with_debug, production environment closed.

--enabled_profiling//Specifies whether the show profile can be used to display the details of the operation execution.

--default_charset//Specifies the default character set, which can be specified in the startup configuration file.

--default_collation//Specify rules for default character comparison, sorting

--with_extra_charsets//Specifies other possible character sets.

--WITH_SSL//Specifies the type of SSL, starting with the default bundled type from 5.6.6, optionally specifying the path address of the SSL library.

--with_zlib//Specifies the type of ZLIB for compression functions.

--with_storage_storage_engine//Specifies the storage engine supported by the compilation, and the Myisam,merge,memory,csv storage engine is supported by default.

--enabled_local_infile//Specifies whether the Load data INFILE feature is allowed.

--with_embedded_server//Specifies whether to compile Libmysqld embedded libraries

--install_layout//Specifies the type of layout to install.

3. Installation Information

Operating system RedHat 6.4

[Email protected] ~]# cat/etc/issue

Red Hat Enterprise Linux Server release 6.4 (Santiago)

MySQL version 5.6.23


The installation directory is:/app/mysql/

The Data directory is:/data/mysqldata

Storage engines include: MEMORY,MYISAM,INNODB, etc.

The character set is: UTF8

4, install the source said the dependency of the library

[Email protected] ~]# yum-y install gcc gcc-c++ autoconf zlib* fiex* libxml* ncurses-devel libmcrypt* Libtool-ltdl-dev el*

5. Download the required packages:

#将下载的文件都放到 The/OPT directory, the following




6, the required package

Installing the CMake Compiler

[Email protected] ~]# cd/opt

[Email protected] ~]# TAR-XVF cmake-

[Email protected] ~]# CD cmake-

[Email protected] ~]#./bootstrap

[[email protected] ~]# make && make install

Installing M4

[Email protected] ~]# TAR-XVF m4-1.4.16.tar.gz

[Email protected] ~]# CD m4-1.4.16

[[email protected] ~]#./configure && make && make install

Installing Bison

[Email protected] ~]# TAR-XVF bison-2.7.tar.gz

[Email protected] ~]# CD bison-2.7

[[email protected] ~]#./configure && make && make install

7. Create MySQL user and group, related directory

[[email protected] ~]#/usr/sbin/groupadd MySQL

[[email protected] ~]#/usr/sbin/useradd-g MySQL MySQL

[Email protected] ~]# mkdir-p/app/mysql

[Email protected] ~]# chown-r mysql:mysql/app/mysql

[Email protected] ~]# mkdir-p/data/mysqldata

[Email protected] ~]# chown-r mysql:mysql/data/mysqldata/

8. Compile and install MySQL

[Email protected] opt]# TAR-ZXVF mysql-5.6.23.tar.gz

[Email protected] opt]# CD mysql-5.6.23

[Email protected] mysql-5.6.23]# export cflags= "-o3-g-fno-exceptions-static-libgcc-fno-omit-frame-pointer- Fno-strict-aliasing "

[Email protected] mysql-5.6.23]# export cxxflags= "-o3-g-FNO-EXCEPTIONS-FNO-RTTI-STATIC-LIBGCC- Fno-omit-frame-pointer-fno-strict-aliasing "

[Email protected] mysql-5.6.23]# export cxx=g++

[Email protected] mysql-5.6.23]# cmake-dcmake_install_prefix=/app/mysql/-dmysql_unix_addr=/tmp/mysql.sock \


-dwith_perfschema_storage_engine=1-dwith_federated_storage_engine=1-dwith_partition_storage_engine=1 \

-dwith_archive_storage_engine=1-dmysql_datadir=/data/mysqldata/-dsysconfdir=/etc \

-dwith_ssl=bundled-denabled_local_infile=1-dwith_innobase_storage_engine=1 \

-dwith_blackhole_storage_engine=1-denable_downloads=1 \

[[email protected] mysql-5.6.23]# make && make install

9. Initialize the database

Copy MySQL configuration file

[email protected] mysql-5.6.23]# CP support-files/my-default.cnf/etc/my.cnf

[Email protected] ~]# cd/app/mysql/scripts/

[Email protected] scripts]#/mysql_install_db--user=mysql--basedir=/app/mysql--datadir=/data/mysqldata/

10. Configure Environment variables

[Email protected] ~]# Vim/etc/profile

Path=/app/mysql/bin:/app/mysql/lib: $PATH

Export PATH

[Email protected] ~]# Source/etc/profile

11. Set Boot Start

[email protected] mysql-5.6.23]# CP support-files/mysql.server/etc/init.d/mysqld

[Email protected] mysql-5.6.23]# chkconfig--add mysqld

[Email protected] mysql-5.6.23]# chkconfig--list mysqld

Mysqld 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off

[Email protected] mysql-5.6.23]# chmod 755/etc/init.d/mysqld

[[Email protected] mysql-5.6.23]# service mysqld start

Starting MySQL. Determine

12. Initialize root password

[[email protected] ~]#/app/mysql/bin/mysqladmin-u root password ' 123456 '

Encountering a problem if the password cannot be initialized, error 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)

[[email protected] ~]#/etc/init.d/mysql stop

[Email protected] ~]# mysqld_safe--user=mysql--skip-grant-tables--skip-networking &

[[email protected] ~]# MySQL

UPDATE user SET Password=password (' 123456 ') WHERE user= ' root ';

FLUSH privileges;

[Email protected] ~]# mysql-uroot-p123456

13. Access Authorization

[[Email protected] ~] #mysql/bin/mysql-uroot-p #敲入该命令后, the screen will prompt for a password, enter the password set in the previous step

Delete the record with the root password blank

mysql> use MySQL;

mysql> Delete from user where password= ';

mysql> flush Privileges;

Configure MySQL to allow root telnet #登录

Mysql> Grant all privileges on * * to [e-mail protected] '% ' identified by "123456";

mysql> flush Privileges;

Mysql> select User,password,host from User;

Linux RedHat 6.4 MySQL5.6 Source Package Installation

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: 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.