Environment: CentOS 6.5 64-bit
1. Download the installation package Http://dev.mysql.com/downloads/mysql/5.5.html#downloads
Http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.49-linux2.6-x86_64.tar.gz
2. Install MySQL
Note: The installation package is uniformly placed in the/USR/LOCAL/SRC directory.
# Uninstall old version of MySQL
Rpm-e mysqlyum-y Remove php-mysqlyum-y remove mysql-server mysql
# Disable SELinux
Setenforce 0
# Install dependent libraries
Yum install-y gcc gcc-c++ kernel-devel NTP vim-enhanced Flex Bison autoconf make Automake bzip2-devel ncurses-devel zlib- Devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libxpm-devel gettext-devel pam-devel libtool Libtool-ltdl OpenSSL openssl-devel fontconfig-devel libxml2-devel curl-devel libicu libicu-devel libmcrypt Libmcrypt-devel libmhash libmhash-devel pcre-devel libtool-libs gd file patch mlocate diffutils readline-devel glibc-deve L Glib2-devel Libcap-develyum install-y Libaio
# move to the installation directory
sudo mkdir/usr/local/mysqlcd/usr/local/srctar-xzvf./mysql-5.5.49-linux2.6-x86_64.tar.gzsudo mv./ mysql-5.5.49-linux2.6-x86_64/*/usr/local/mysql
# New User
sudo groupadd mysqlsudo useradd-g mysql-s/usr/sbin/nologin mysql #不让mysql用户直接登录sudo chown-r mysql:mysql/usr/local/m ysql/
# Copy configuration file
Cp/usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf
# Set permissions
chmod +x/usr/local/mysqlchown-r Mysql:mysql/usr/local/mysql
# Configure Boot Auto start
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqldchmod +x/etc/init.d/mysqldchkconfig--add Mysqldchkconfig--level 2345 mysqld onchkconfig--list mysqld #查看是否已应用上
# Add a soft link to MySQL to fit the init script
LN-SV/USR/LOCAL/MYSQL/BIN/MYSQL/USR/SBIN/MYSQLLN-SV/USR/LOCAL/MYSQL/BIN/MYSQLADMIN/USR/SBIN/MYSQLADMINLN-SV/ Usr/local/mysql/bin/mysqldump/usr/sbin/mysqldump
# Modify configuration file
Vim/etc/my.cnf
# added in the [MYSQLD] node
DataDir =/usr/local/mysql/datalog-error =/usr/local/mysql/data/error.logpid-file =/usr/local/mysql/data/ Mysql.piduser = Mysqltmpdir =/tmp
# Save Exit
# Initialize Database
sudo/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user= Mysql
# Change Root password
/usr/local/mysql/bin/mysqladmin-u root-p Password "123456"
3. Configure the Firewall
# Configure the firewall to turn on port 3306
Vim/etc/sysconfig/iptables
# Add the following rule to port 22 below this rule
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
# Restart Firewall
/etc/init.d/iptables Restart # or service iptables restart
# start MySQL
Service mysqld Start # or/etc/init.d/mysqld start
4. Test if MySQL is started
# See if there is a MySQL process
Ps-ef | grep MySQL
# See if there is a MySQL port
NETSTAT-NTLP | grep 3306
# test whether the Mysql,mysqladmin,mysqldump command is working properly
# Read the MySQL version information
Mysqladmin version
To this MySQL compilation installation is complete.
CentOS6.5 Unzip and install the binary distribution version mysql-5.5.49-linux2.6-x86_64.tar.gz