MySQL-5.6.22-1.el7.src.rpm
(参考自mysql官方手册:http://dev.mysql.com/doc/refman/5.6/en/installing-source-distribution.html)
cd ~ cp /mnt/hgfs/shared_file/MySQL-5.6.22-1.el7.src.rpm ./ rpm -i MySQL-5.6.22-1.el7.src.rpm mv ./rpmbuild/SOURCES/mysql-5.6.22.tar.gz ./ \rm -r MySQL-5.6.22-1.el7.src.rpm rpmbuild/ tar zxf mysql-5.6.22.tar.gz cd mysql-5.6.22 mkdir /home/data
由于安装还要有用到ncurses-devel cmake,所以
yum install ncurses-devel cmake -y
groupadd mysql useradd -r -g mysql mysql
(注意:由于从新的MySQL5.6开始编译采用CMake 编译参数见mysql源码安装手册:http://dev.mysql.com/doc/refman/5.6/en/mysql-install-db.html
)
例:
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=/home/data/ \ -DMYSQL_TCP_PORT=3306 \ -DENABLE_DOWNLOADS=1
make make install
出错后重新运行配置,需要删除CMakeCache.txt文件
rm CMakeCache.txt
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=/home/data
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
(注:如果/etc/my.cnf文件存在,则覆盖。)
cp support-files/mysql.server /etc/init.d/mysqld
vi /etc/profile #在文件末尾加入 PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH export PATH #保存退出并运行 source /etc/profile #重新加载该文件
service mysqld start chkconfig --level 35 mysqld on
netstat -tulnp | grep 3306
mysqladmin -uroot password ‘你的密码’
\rm -r mysql-5.6.22 mysql-5.6.22.tar.gz
至此MySQL安装完成,下面安装PHP