源码安装
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz
下载依赖包

yum -y install cmake bison git ncurses-devel gcc gcc-c++

groupadd mysql :如果没有mysql用户那就创建一个如果有那就忽略
useradd -g mysql mysql :创建一个mysql的组如果有那就忽略

解压
tar -zxvf mysql-5.6.38.tar.gz
然后创建mysql的目录一会编译指定放到/usr/local/mysql
所以
mkdir /usr/local/mysql
mkdir /usr/local/mysql/data

cd mysql-5.6.38/
开始编译安装
cmake (同configure一样,生成makefile工具)

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DENABLE_DOWNLOADS=1

make编译
make install

修改目录属主权限
chown -R mysql:mysql /usr/local/mysql/data/
chown -R mysql:mysql /usr/local/mysql/

数据库初始化
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/mysql --pid-file=/usr/local/mysql/data/mysql/mysql.pid --tmpdir=/tmp

缺少perl-Data-Dumper.rpm
rpm -ivh .....rpm

chown -R mysql:mysql my.cnf

++++++++++++++++++++++++++++
vim my.cnf
++++++++++++++++++++++

basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
#port = .....
#server_id = .....
socket = /usr/local/mysql/mysql.sock
log-error= /usr/local/mysql/data/error.log
pid-file = /usr/local/mysql/data/mysql.pid
user = mysql
tmpdir = /tmp
++++++++++++++++++++++++++++++++++

cd /usr/local/mysql/support-files
./mysql.server start
mysql启动
++++++++++++++++++++++++++++++++++
cd /usr/local/mysql/bin
./mysql -u root -p
回车