原文:http://blog.csdn.net/u011364306/article/details/47604617
1.拷贝cmake-2.8.8.tar.gz和mysql-5.5.32.tar.gz至/opt文件夹下
2.切换到opt目录
[root@mysql ~]# cd /opt
[root@mysql opt]# ls
cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz rh
3.解压cmake文件
[root@mysql opt]# tar xf cmake-2.8.8.tar.gz
[root@mysql opt]# cd cmake-2.8.8
[root@mysql cmake-2.8.8]# ls
bootstrap CompileFlags.cmake doxygen.config
ChangeLog.manual configure Example
ChangeLog.txt Copyright.txt Modules
CMakeCPack.cmake CTestConfig.cmake Readme.txt
CMakeCPackOptions.cmake.in CTestCustom.cmake.in Source
CMakeGraphVizOptions.cmake CTestCustom.ctest.in Templates
CMakeLists.txt DartConfig.cmake Tests
CMakeLogo.gif DartLocal.conf.in Utilities
cmake_uninstall.cmake.in Docs
4.进行cmake的安装
[root@mysql cmake-2.8.8]
CMake has bootstrapped. Now run gmake.
[root@mysql cmake-2.8.8]
[root@mysql cmake-2.8.8]
5.添加mysql用户和组
[root@mysql cmake-2.8.8]
[root@mysql cmake-2.8.8]
6.yum安装ncurses-devel
[root@mysql /]
7.解压mysql文件
[root@mysql /]
[root@mysql opt]
[root@mysql opt]
[root@mysql mysql-5.5.32]
BUILD CMakeLists.txt COPYING include libmysqld mysys regex sql-common tests win
BUILD-CMAKE cmd-line-utils dbug INSTALL-SOURCE libservices packaging scripts storage unittest zlib
client config.h.cmake Docs INSTALL-WIN-SOURCE man plugin sql strings VERSION
cmake configure.cmake extra libmysql mysql-test README sql-bench support-files vio
8.安装之前编译mysql
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/tmp/mysql.sock \
-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
9.mysql安装
[root@mysql mysql-5.5.32]
[root@mysql mysql-5.5.32]
如果make到63%左右出现错误:
make[2]: * [storage/perfschema/unittest/pfs_connect_attr-t] Error 1
make[1]: * [storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/all] Error 2
则:cmake去掉-DWITH_PARTITION_STORAGE_ENGINE=1参数重新编译
10.选择配置文件
[root@mysql mysql-5.5.32]# cp support-files/my-small.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
11.查看是否有mysql/data目录
[root@mysql mysql-5.5.32]
total 4
drwxr-xr-x. 2 root root 4096 Aug 15 15:38 test
12.相关授权
[root@mysql mysql-5.5.32]
[root@mysql mysql-5.5.32]
13.数据库初始化
[root@mysql mysql-5.5.32]
[root@mysql scripts]
mysql_install_db
[root@mysql scripts]
[root@mysql scripts]
Installing MySQL system tables...
OK
Filling help tables...
OK
14.启动配置
[root@mysql mysql]
[root@mysql mysql-5.5.32]
[root@mysql mysql-5.5.32]
[root@mysql mysql-5.5.32]
Starting MySQL.. SUCCESS!
[root@mysql mysql-5.5.32]
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 28462/mysqld
15.配置环境变量
[root@mysql mysql-5.5.32]# echo 'export PATH=/application/mysql/bin:$PATH'>>/etc/profile
[root@mysql mysql-5.5.32]# tail -1 /etc/profile
export PATH=/application/mysql/bin:$PATH
[root@mysql mysql-5.5.32]# source /etc/profile
[root@mysql mysql-5.5.32]# echo $PATH
/application/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
16.登陆mysql,删除无用配置
[root@mysql mysql-5.5.32]# mysql
mysql> delete from mysql.user where user='';
mysql> delete from mysql.user where host='mysql';
mysql> delete from mysql.user where host='::1';
| root | 127.0.0.1 |
mysql> drop database test;
17.配置登陆密码
[root@mysql mysql-5.5.32]
18.设置mysql开机启动
[root@mysql mysql-5.5.32]
[root@mysql mysql-5.5.32]
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
19.查看系统语言
[root@mysql mysql-5.5.32]
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"