First, check the system version platform:
[Root @ localhost ~] # Cat/etc/RedHat-release
CentOS release 6.4 (Final)
[Root @ localhost ~] # Uname-
Linux localhost. localdomain 2.6.32-358. el6.x86 _ 64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
MySQL-5.6.10 and MySQL-5.5.34 for source code compilation and installation on CentOS 6.2
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
I. Preparations
1. Add an epel Source
[Root @ localhost ~] #
Rpm-ivhhttp: // dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[Root @ localhost ~] # Rpm -- import/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
2. Install the yum acceleration component:
[Root @ localhost ~] # Yum install yum-plugin-fastestmirror-y
Run yum to report Error: Cannot retrieve metalink for repository: epel. Please verifyits path and try agai
[Root @ localhost appstores] # yum installyum-plugin-fastestmirror-y
Loaded plugins: fastestmirror, security
Determining fastest mirrors
Error: Cannot retrieve metalink forrepository: epel. Please verify its path and try again
Solution: Compile/etc/yum. repos. d/epel. repo and make the following changes:
# Baseurl = http://download.fedoraproject.org/pub/epel/6/?basearch
Using list = https://mirrors.fedoraproject.org/metalink? Epel-6 & arch = $ basearch
Bytes
Baseurl = http://download.fedoraproject.org/pub/epel/6/?basearch
# Items list = https://mirrors.fedoraproject.org/metalink? Epel-6 & arch = $ basearch
------------------------------
[Root @ localhost appstores] # yum installyum-plugin-fastestmirror-y
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* Base: mirrors.btte.net
* Extras: mirrors.btte.net
* Updates: mirrors.btte.net
Epel/primary_db | 6.1 MB
Extras | 3.4 kB: 00
Extras/primary_db | 19 kB: 00
Updates | 3.4 kB: 00
Updates/primary_db | 3.1 MB
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Packageyum-plugin-fastestmirror.noarch. 1.30-14. el6 will be updated
---> Packageyum-plugin-fastestmirror.noarch. 1.30-17. el6_5 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
========================================================== ========================================================== ==============
Package Arch Version Repository Size
========================================================== ========================================================== ==============
Updating:
Yum-plugin-fastestmirror noarch 1.1.30-17. el6_5 updates 28 k
Transaction Summary
========================================================== ========================================================== ==============
Upgrade 1 Package (s)
Total download size: 28 k
Downloading Packages:
Yum-plugin-fastestmirror-1.1.30-17.el6_5.noarch.rpm | 28 kB 00: 00
Warning: rpmts_HdrFromFdno: Header V3RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid: CentOS-6 Key (CentOS 6 OfficialSigning Key) <centos-6-key@centos.org>
Package: centos-release-6-4.el6.centos.10.x86_64 (@ anaconda-CentOS-201303020151.x86_64/6.4)
From:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Updating: yum-plugin-fastestmirror-1.1.30-17.el6_5.noarch 1/2
Cleanup: yum-plugin-fastestmirror-1.1.30-14.el6.noarch 2/2
Verifying: yum-plugin-fastestmirror-1.1.30-17.el6_5.noarch 1/2
Verifying: yum-plugin-fastestmirror-1.1.30-14.el6.noarch 2/2
Updated:
Yum-plugin-fastestmirror.noarch 0: 1. 1.30-17. el6_5
Complete!
----------------------------------------------
3. Prepare the environment required for MySQl Compilation
[Root @ localhost ~] # Yum-y install makegcc-c ++ bison-devel ncurses-devel
4. Compile and install cmake
[Root @ localhost ~] # Wgethttp: // wwwNaNake.org/files/v2.8/cmake-2.8.12.2.tar.gz
[Root @ localhost ~] # Tar xfcmake-2.8.12.2.tar.gz
[Root @ localhost ~] # Cd cmake-2.8.12.2
[Root @ localhost cmake-2.8.12.2] #./configure -- prefix =/usr/local/cmake
[Root @ localhost cmake-2.8.12.2] # gmake
[Root @ localhost cmake-2.8.12.2] # makeinstall
5. Add environment variables for cmake
[Root @ localhost ~] # Vim/etc/profile
[Root @ localhost ~] # Source/etc/profile
[Root @ localhost ~] # Tail-n2/etc/profile
PATH = $ PATH:/usr/local/cmake/bin
Export PATH
5. Prepare MySql users and groups:
[Root @ localhost ~] # Groupadd mysql & useradd-s/sbin/nologin-g mysql-M mysql
[Root @ localhost ~] # Grep mysql/etc/passwd/etc/group
/Etc/passwd: mysql: x: 500: 500:/home/mysql:/sbin/nologin
6. Create a MySQL data storage directory and grant permissions:
[Root @ localhost ~] # Mkdir/data/mysql56-pv
Mkdir: created directory '/data'
Mkdir: created directory '/data/mysql56'
[Root @ localhost ~] # Chown-R mysql. mysql/data/mysql56
[Root @ localhost ~] # Ls-ld/data/mysql56
Drwxr-xr-x. 2 mysql 4096 May 21/data/mysql56
7. Download and decompress the MySQL source package
[Root @ localhost ~ ] # Wgethttp: // mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.17.tar.gz
[Root @ localhost ~ ] # Tar xfMySQL-5.6/mysql-5.6.17.tar.gz
For more details, please continue to read the highlights on the next page: