从源码安装 mysql5.1

2010-10-20

系统环境:

OS: debian5.0 arch: i386 kernel: 2.6.26-2-xen-686

安装mysql5.1:

./configure --prefix=/opt/mysql5/ \
--enable-largefile \
--with-charset=gbk \
--with-pthread \
--with-unix-socket-path=/tmp/mysql.sock \
--enable-assembler \
--enable-thread-safe-client --without-debug \
--with-atomic-ops=smp \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \
--with-big-tables \
--without-ndb-debug \
--with-embedded-server \
--without-docs \
--without-man \
--with-plugins=partition

make && make install



groupadd dba
useradd -g dba -d /opt/mysql5 -s /bin/false mysql
chown -R mysql.dba /opt/mysql5
cp /opt/mysql5/share/mysql/my-medium.cnf /etc/my.cnf

初始化数据库:

/opt/mysql5/bin/mysql_install_db --user=mysql

启动数据库:

/opt/mysql5/share/mysql/mysql.server start