第一章 安装cmake
[root@oldboy ~]# mkdir -p /home/oldboy/tools [root@oldboy ~]# cd /home/oldboy/tools/ [root@oldboy tools]# rz -y 上传cmake-2.8.8.tar.gz和mysql-5.5.32.tar.gz [root@oldboy tools]# ls cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz [root@oldboy tools]# tar xf cmake-2.8.8.tar.gz [root@oldboy tools]# ls cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz [root@oldboy tools]# cd cmake-2.8.8 [root@oldboy cmake-2.8.8]# ./configure 最后提示 CMake has bootstrapped. Now run gmake. [root@oldboy cmake-2.8.8]# gmake [root@oldboy cmake-2.8.8]# gmake install [root@oldboy cmake-2.8.8]# cd ..
第二章 安装MySQL
2.1安装mysql依赖包
[root@oldboy tools]# yum install ncurses-devel -y
2.1cmake前准备工作
[root@oldboy tools]# ls cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz [root@oldboy tools]# tar xf mysql-5.5.32.tar.gz [root@oldboy tools]# cd mysql-5.5.32 [root@oldboy mysql-5.5.32]# mkdir -p /application/mysql-5.5.32 [root@oldboy mysql-5.5.32]# mkdir -p /application/mysql-5.5.32/data [root@oldboy mysql-5.5.32]# useradd mysql -s /sbin/nologin -M
cmake编辑前检查环境
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \ -DMYSQL_DATADIR=/application/mysql-5.5.32/data \ -DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/data \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \ -DENABLED_LOCAL_INFILE=ON \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ -DWITHOUT_PARTITION_STORAGE_ENGINE=1 \ -DWITH_FAST_MUTEXES=1 \ -DWITH_ZLIB=bundled \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_READLINE=1 \ -DWITH_EMBEDDED_SERVER=1 \ -DWITH_DEBUG=0
make 编译&& make install 安装
[root@oldboy mysql-5.5.32]# make && make install
安装完成后做个软连接
[root@oldboy mysql-5.5.32]# ln -s /application/mysql-5.5.32/ /application/mysql [root@oldboy mysql-5.5.32]# cd .. [root@oldboy tools]# ls cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32 mysql-5.5.32.tar.gz
选择配置文件:
测试环境选小的,生产环境可以根据硬件选择,例如:my-innodb-heavy-4G.cnf
选择一个小的模板my-small.cnf放到/etc/my.cnf(因为是测试环境,如果生产环境,可以选择大的模板)
[root@oldboy tools]# /bin/cp mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf
配置环境变量:
[root@oldboy tools]# echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile [root@oldboy tools]# tail -1 /etc/profile [root@oldboy tools]# source /etc/profile [root@oldboy tools]# echo $PATH
故障问题:http://oldboy.blog.51cto.com/2561410/1122867
初始化(容易出错的地方)
[root@oldboy mysql-5.5.32]# mkdir -p /application/mysql/data/ #建立mysql数据文件目录 [root@oldboy tools]# chown -R mysql.mysql /application/mysql/data/ [root@oldboy tools]# chown -R 1777 /tmp/ #授权mysql用户访问mysql的安装目录
[root@oldboy tools]# cd /application/mysql/scripts/ [root@oldboy scripts]# ./mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql 初始化成功的标志如下两个OK所示: WARNING: The host 'oldboy' could not be looked up with resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MySQL privileges ! Installing MySQL system tables... OK Filling help tables... OK
[root@oldboy scripts]# cd /home/oldboy/tools/mysql-5.5.32 [root@oldboy mysql-5.5.32]# /bin/cp support-files/mysql.server /etc/init.d/mysqld [root@oldboy mysql-5.5.32]# chmod +x /etc/init.d/mysqld [root@oldboy mysql-5.5.32]# /etc/init.d/mysqld start