1.下载源码包
MySQL 5.5.42下载地址
http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.5/mysql-5.5.42.tar.gz
cmake 3.2.1下载地址
http://www.cmake.org/files/v3.2/cmake-3.2.1.tar.gz
2.检查环境:
rpm -qa | grep cmake
rpm -qa | grep gcc
rpm -qa | grep gcc-c++
3.安装篇:
cmake-3.2.1
通过xftp上传cmake-3.2.1.tar.gz至/usr/local/src
#tar zxvf cmake-3.2.1.tar.gz
#cd /usr/local/src/cmake-3.2.1
#./configure --prefix=/usr/local/cmake
#make && make install
#vim ~/.bash_profile
修改PATH=$PATH:$HOME/bin
PAHT=$PATH:$HOME/bin:/usr/local/cmake/bin
保存退出
#source ~/.bash_profile
mysql-5.5.42
#cd /usr/local/src/
#tar zxvf mysql-5.5.42.tar.gz
#cd mysql-5.5.42
#useradd -r -s /sbin/nologin mysql
#cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGING=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=ALL -DMYSQL_USER=mysql
#gmake
#make install
#cd /usr/local/mysql
#cd support-files/
#ls mysql.server(查看是否有x权限)
#cp mysql.server /etc/init.d/mysql
#cp my-large.cnf /etc/my.cnf
#vim /etc/my.cnf
添加如下行:
basedir = /usr/local/mysql
datadir = /data/mysql
socker = /tmp/mysqld.sock
port = 3306
保存退出
#mkdir -p /data/mysql
#chown -R mysql. /data/mysql
#cd /usr/local/mysql/scripts/
#./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --no-defaults --user=mysql
#cd /data/mysql
#ls
#service mysql start
#ps -ef | grep mysql(查看是否存在mysql进程)
#vim ~/.bash_profile
在PATH变量后面追加":/usr/local/mysql/bin",修改完成后的结果如下:
PATH=$PATH:$HOME/bin:/usr/local/cmake/bin:/usr/local/mysql/bin(注:/usr/local/cmake/bin目录为本实验编译安装所生成的目录,如果您的cmake是通过rpm或者是yum来安装的,无此路径。PATH=$PATH:$HOME/bin:/usr/local/mysql/bin)
#source ~/.bash_profile
也可修改全局变量
#vim /etc/bashrc
在最后添加
PATH=$PATH:/usr/local/mysql/bin:/usr/local/cmake/bin(注:/usr/local/cmake/bin为本实验编译安装所生成的目录。)
#mysql
mysql>\s