ubuntu 10.10 源码编译安装mysql 5.1

来源:互联网 发布:项目管理平台 java 编辑:程序博客网 时间:2024/05/01 15:02

最近在本子上面装了个virtualbox,ubuntu很快也安装完毕,准备把mysql 5.1和mysql 5.5都安装上,以下是5.1的编译安装步骤:

 

1. 降级gcc/g++ 至4.3:
 apt-get install gcc-4.3(安装gcc-4.3)
 apt-get install g++-4.3(安装g++-4.3)
 apt-get install g++-4.3-multilib (安装g++-4.3-multilib)

修改默认的gcc为4.3版本:
 ln -f /usr/bin/gcc-4.3 gcc 
 ln -f /usr/bin/g++-4.3 g++

查看目前的版本:
# gcc --version
gcc (Ubuntu 4.3.5-3ubuntu1) 4.3.5
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2. 安装必要的包
2.1 安装ncurses:
 apt-get install  libncurses5-dev

2.2 安装libtool:
 apt-get install  libtool

2.3  修改configure的第51368行,改为RM="$RM -f"

这个地方出了一个小patch的,具体可以google下。


3. root 登陆,执行如下步骤:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-5.1.4.tar.gz | tar -xvf
shell> cd mysql-5.1.4
shell>
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors /
-fno-exceptions -fno-rtti" ./configure /
--prefix=/usr/local/mysql --with-extra-charsets=all /
--with-plugins=partition,heap,innobase,innodb_plugin,myisam,myisammrg,csv --enable-assembler

 

shell> make     ---如cpu比较强劲,此处可加-j 参数+num
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
bin/mysql_install_db --user=mysql

 

然后就可以启动了,

mysqld_safe --user=mysql &

 

下午安装5.5时再记录一下,哇哈哈