Brief introduction:
Environment: Virtual Machine +centos6.6
MySQL version: 5.6.21
Mysql:http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.21.tar.gz
Cmake:http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz
1, Pre-installation configuration:
Vi/etc/sysconfig/iptables opening the firewall port
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT add 3306 port
ESC+:WQ exit
Service iptables Restart Restart firewall
Turn off SELinux (cause I don't know, anyway I do this when I install a lot of software)
Vi/etc/selinux/config
Log off the default ' # ' and add a selinux=disabled
I keep the downloaded package in the/usr/local directory, so if the reader is in the reference document and his own directory is inconsistent, please follow your own directory to modify
Run the Yum library:
yum install -y apr* autoconf automake bison bzip2 bzip2* cloog-ppl compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng* libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libxpm* libx* libtiff libtiff* make mpfr ncurses* ntp openssl nasm nasm* openssl-devel patch pcre-devel perl php-common php-gd policycoreutils ppl telnet t1lib T1lib* wget zlib-devel
Check if the system has an older version of MySQL, the old version of the installation, but start the MySQL service can not start, so to uninstall the old version of MySQL line, the command is as follows:
Yum remove MySQL mysql-server mysql-libs compat-mysql
I executed this statement when the old version
Loaded Plugins:fastestmirror, Refresh-packagekit, security
Setting up Remove Process
No Match for Argument:mysql
Loading mirror speeds from cached Hostfile
* base:mirrors.163.com
* extras:centos.ustc.edu.cn
* updates:centos.ustc.edu.cn
Package (s) for MySQL available, but not installed.
No Match for Argument:mysql-server
Package (s) mysql-server available and not installed.
No Match for Argument:compat-mysql
Resolving Dependencies
-- Running transaction Check
---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 'll be erased
--processing dependency:libmysqlclient.so.16 () (64bit) for package:2:postfix-2.6.6-6.el6_5.x86_64
-- processing dependency:libmysqlclient.so.16 (libmysqlclient_16) (64bit) for package:2:postfix-2.6.6-6.el6_ 5.x86_64
-- processing dependency:mysql-libs for package:2:postfix-2.6.6-6.el6_5.x86_64
-- Running transaction Check
---> Package postfix.x86_64 2:2.6.6-6.el6_5 'll be erased
- processing Dependency:/usr/sbin/sendmail for package:cronie-1.4.4-12.el6.x86_64
-- Running transaction Check
---> Package cronie.x86_64 0:1.4.4-12.el6 'll be erased
-- processing Dependency:cronie = 1.4.4-12.el6 for package:cronie-anacron-1.4.4-12.el6.x86_64
-- Running transaction Check
---> Package cronie-anacron.x86_64 0:1.4.4-12.el6 'll be erased
- processing Dependency:/ETC/CRON.D for Package:crontabs-1.10-33.el6.noarch
- processing Dependency:/ETC/CRON.D for package:sysstat-9.0.4-27.el6.x86_64
--Restarting Dependency Resolution with new changes.
-- Running transaction Check
---> Package crontabs.noarch 0:1.10-33.el6 'll be erased
---> Package sysstat.x86_64 0:9.0.4-27.el6 'll be erased
-- finished Dependency Resolution
Dependencies resolved
=========================================================================================================== ============================
Package Arch Version Repository Size
=========================================================================================================== ============================
Removing:
mysql-libs x86_64 5.1.73-3.el6_5 @anaconda-centos-201410241409.x86_64/6.6 4.0 M
Removing for dependencies:
Cronie x86_64 1.4.4-12.el6 @anaconda-centos-201410241409.x86_64/6.6 174 k
Cronie-anacron x86_64 1.4.4-12.el6 @anaconda-centos-201410241409.x86_64/6.6 k
crontabs noarch 1.10-33.el6 @anaconda-centos-201410241409.x86_64/6.6 2.4 k
postfix x86_64 2:2.6.6-6.el6_5 @anaconda-centos-201410241409.x86_64/6.6 9.7 M
sysstat x86_64 9.0.4-27.el6 @anaconda-centos-201410241409.x86_64/6.6 825 k
Transaction Summary
=============================================================================================================== ========================
Remove 6 Package (s)
Installed size:15 M
Need to uninstall before the line, anyway, as prompted to enter ' Y ' old version is uninstalled,
2, installation CMake
Cd/usr/local
Tar zxvf cmake-3.0.2.tar.gz
Perform the above command decompression;
Enter the cmake-3.0.2 directory,
./configure performing the compilation
Make && make install
3. Install MySQL
Groupadd MySQL add MySQL group
Useradd-g MySQL mysql-s/bin/false add MySQL user to MySQL group
Mkdir-p/data/mysql Create a MySQL storage directory
Chown-r mysql:mysql/data/mysql Set the MySQL database storage permissions
If this goes wrong, go inside the Cd/data directory.
chmod 777 MySQL directly gives all permissions
Mkdir-p/usr/local/mysql Creating a MySQL installation directory
Cd/usr/local into the Software storage directory
Tar zxvf mysql-5.6.21.tar.gz unzip MySQL
CD mysql-5.6.21 into MySQL directory
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-dsysconfdir=/etc
Make && make install installs and compiles
RM-RF/ETC/MY.CNF Delete the default configuration file for MySQL, otherwise the following operation will be wrong
Cd/usr/local/mysql into the MySQL installation directory
./scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql
Build a MySQL system database
Ln-s/usr/local/mysql/my.cnf/etc/my.cnf Add a soft connection in the/etc directory
CP./SUPPORT-FILES/MYSQL.SERVER/ETC/RC.D/INIT.D/MYSQLD add MySQL to the system boot
chmod 755/etc/init.d/mysqld give mysqld Execute permission
If this operation goes wrong, go directly to CD/ETC/INIT.D
chmod 777 Mysqld directly gives all permissions
Vi/etc/rc.d/init.d/mysqld Editing mysqld Startup items
Basedir=/usr/local/mysql
Datadir=/data/mysql
esc+:+wq! Save exit
Vi/etc/profile Modifying a configuration file
Add Export path= $PATH:/usr/local/mysql/bin
esc+:+wq! Save exit
Source/etc/profile making the configuration file effective
Service Msyqld Start
Well, MySQL is installed, we verify
Thank you for your support, I have encountered a lot of problems before installing MySQL, many of the online search tutorials are copied, this article refer to the system Operation»centos 6.6 compiled installation nginx1.6.2+mysql5.6.21+php5.6.3 Combined with their own situation to organize out in line with my own study habits, in this thank you predecessors do not leave the share!
centos6.6 compiling and installing the LNMP series MySQL