ubuntu手工编译mysqlserver

1、下载mysql source
2、安装编译环境和依赖包

sudo apt-get install cmake bison libncurses5-dev libssl-dev;

Centos 5.7 x86_64要安装如下包。

sudo yum install cmake;
sudo yum install bison;
sudo yum install ncurses-devel ;
sudo yum install -y gcc-c++;
yum -y install libtool;

创建用户
adduser mysql

sudo groupadd mysql --system
sudo adduser --system --no-create-home mysql
sudo usermod -a -G mysql mysql

3、编译

cd wangliang@ubuntu:~/Desktop/mysql-5.5.29
make clean;
rm -f CMakeCache.txt;
cmake . \
-DCMAKE_INSTALL_PREFIX=/data/mysql/current \
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
-DMYSQL_DATADIR=/data/mysql/data \
-DSYSCONFDIR=/data/mysql/current \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=complex \
-DWITH_SSL=yes  \
-DWITH_DEBUG=0 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
 
./configure \
--prefix=/data/mysql/mysql-5.1.72/server \
--sysconfdir=/data/mysql/mysql-5.1.72/server \
--localstatedir=/data/mysql/mysql-5.1.72/data \
--with-tcp-port=3306 \
--without-debug \
--without-ndb-debug \
--enable-thread-safe-client \
--enable-assembler \
--enable-profiling \
--with-big-tables \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags="-all-static -ltinfo" \
--with-charset=utf8 \
--with-collation=utf8_general_ci \
--with-extra-charsets=all \
--with-plugins=all \
--with-mysqld-user=mysql \
--without-embedded-server \
--with-unix-socket-path=/tmp/mysqld.sock
 
sudo -u mysql ./mysql_install_db \
--basedir=/data/mysql/current/server \
--datadir=/data/mysql/current/data;

4、安装

make;
make install;

5、初始化数据

cp /data/mysql/current/support-files/my-medium.cnf /data/mysql/current/my.cnf
sudo rm /etc/mysql/my.cnf
sudo chown -R mysql:mysql /data/mysql/data;
sudo -u mysql /data/mysql/current/scripts/mysql_install_db --basedir=/data/mysql/current --datadir=/data/mysql/data;
sudo cp /data/mysql/current/support-files/mysql.server /etc/init.d/

6、启动

sudo /etc/init.d/mysql.server start

参考资料
http://blog.sina.com.cn/s/blog_4c197d4201017raf.html
http://bbs.ywlm.net/thread-1018-1-1.html
http://www.bwxxkj.com/a/jishuzhongxin/shujukukaifa/2012/0923/142513.html

 
mysql 5.1.73编译 //2013-12-30
 
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti -fomit-frame-pointer -ffixed-ebp"
export CFLAGS CXX CXXFLAGS 
 
vim configure
52125 #    $RM "$cfgfile"
 
./configure \
--prefix=/data/mysql/mysql-5.1.73 \
--datadir=/data/mysql/mysql-5.1.73/data \
--with-charset=utf8 \
--with-collation=utf8_general_ci \
--with-extra-charsets=all \
--enable-assembler \
--enable-thread-safe-client \
--enable-local-infile \
--with-big-tables \
--with-readline \
--with-ssl \
--with-embedded-server \
--with-tcp-port=3306 \
--with-unix-socket-path=/tmp/mysqld.sock \
--with-plugins=max \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static

原创文章,转载请注明: 转载自海波无痕

本文链接地址: ubuntu手工编译mysqlserver

文章的脚注信息由WordPress的wp-posturl插件自动生成

此条目发表在server分类目录,贴了, , 标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

评论链接可以 移除 nofollow.