yum install gcc gcc-c++ ncurses-devel perl -y
wget https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz
tar xzvf cmake-3.9.0.tar.gz
cd cmake-3.9.0/
./bootstrap
make
make install
groupadd mysql
useradd -r -g mysql mysql
mkdir -p /usr/local/mysql
mkdir -p /data/mysqldb
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz
tar xzvf mysql-5.6.16.tar.gz
cd mysql-5.6.16/
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=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1
rm CMakeCache.txt
make
make install
cd /usr/local/mysql/
chown -R mysql:mysql .
cd /data/mysqldb/
chown -R mysql:mysql .
cd /usr/local/mysql/
scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb
可能遇到问题
Can't locate Data/Dumper.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./mysql_install_db line 42. BEGIN failed--compilation aborted at ./mysql_install_db line 42.
解决方法
yum install 'perl(Data::Dumper)' -y
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
vim /etc/my.cnf
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /data/mysqldb/
port = 3306
server_id = 136
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
vim /etc/profile
在最后添加
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATH
source /etc/profile
service mysqld start
mysql -uroot