wget
2.解压
tar -zxf mysql-5.6.11.tar.gz
3.切换目录
cd mysql-5.6.11
4.创建用户和组
1、groupadd mysql
2、useradd -r -g mysql mysql
5.安装工具
yum -y install cmake ncurses-devel bison gcc-c++ make
6.cmake
cmake .
如果改不出错则删除cake文件
rm CMakeCache.txt
7.
make & make install
8.后续步奏:
1、cd /usr/local/mysql
2、chown mysql.mysql .
3、scripts/mysql_install_db --user=mysql
4、chown -R root .
5、chown -R mysql data
6、cp support-files/my-default.cnf /etc/my.cnf
7、bin/mysqld_safe --user=mysql &
8、cp support-files/mysql.server /etc/rc.d/init.d/mysqld
9、chkconfig --add mysqld
10、chkconfig mysqld on
注意事项:
编译过程中遇到的几个错误
1.– Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:82 (MESSAGE):
Curses library not found. Please install appropriate package,
解决办法:yum -y install ncurses-devel
2.Warning: Bison executable not found in PATH
– Configuring done
– Generating done
– Build files have been written to: /software/mysql-5.6.11
解决办法:yum -y install bison
3.CMake Error at /usr/share/cmake-2.8/Modules/CMakeCXXInformation.cmake:35 (GET_FILENAME_COMPONENT):
get_filename_component called with incorrect number of arguments
解决办法: yum install -y gcc-c++
注意:重新cmake之前必须 删除CMakeCache.txt
===========================================
在编译安装的过程中,可能会出现一些异常,主要的原因还是系统的依赖包没有安装上去,编译安装mysql之前,一定要把上述提到的包全部安装;
比如这个错误:
mysqld.cc: In function ‘void handle_connections_sockets()’:
主要是没有安装libmcrypt相关的包
直接使用yum install libmcrypt* -y安装完成后,在重新编译
在编译出现异常,在重新编译的时候,需要先删除mysql目录下的CMakeCache.txt这个文件,然后再进行编译!!!
Bug 34882 - g++: Internal error: Killed (program cc1plus)
找到问题的原因,然后解决它,解决办法:
内存不足, 在linux下增加临时swap空间
如果想关闭刚开辟的swap空间,只需命令:#swapoff
==================================================================================================
Status: RESOLVED INVALID
Product: gcc
Component: middle-end
Version: 4.2.3
Importance: P3 normal
Target Milestone: ---
Assigned To: Not yet assigned to anyone
URL:
Keywords: memory-hog
Depends on:
Blocks: Show dependency tree / graph
Reported: 2008-01-20 06:01 UTC by steven ou
Modified: 2008-02-02 12:06 UTC (History)
CC List: 3 users (show)
See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:
The initialize_command_download() exposes the usual memory-hungriness of GCC
with repetitive C++ initializers. We have plenty of bugreports with testcases
for this, closing as invalid. And yes, 32MB + 200MB swap will never make
you happy with C++ and gcc.
step 1:
#dd if=/dev/zero of=/home/swap bs=1024 count=500000
注释:of=/home/swap,放置swap的空间; count的大小就是增加的swap空间的大小,1024就是块大小,这里是1K,所以总共空间就是bs*count=500M
step 2:
# mkswap /home/swap
注释:把刚才空间格式化成swap各式
step 3:
#swapon /home/swap
注释:使刚才创建的swap空间