1.下载Mysql的社区版 mysql-5.0.51b.tar.gz
2. 解压缩:
> tar zxvf mysql-5.0.51b.tar.gz
> cd mysql-5.0.51b
3. configure:
> CFLAGS="-O3" CXX=gcc CXXFLAGES="-O3 -felide-constructors \
> -fno-exceptions -fno-rtti" \
> ./configure --prefix=/usr/local/mysql \
> --enable-assembler \
> --with-mysqld-ldflags=-all-static \
> --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
> --with-client-ldflags=-all-static \
> --with-extra-charsets=all
4. make & install
> make
> sudo make install
5. 增加用户
> sudo groupadd mysql
> sudo useradd -g mysql mysql
6. 拷贝初始配置文件和启动脚本
> sudo cp support-files/my-medium.cnf /etc/my.cnf
> sudo cp support-files/mysql.server /etc/init.d/mysql
> sudo chmod a+x /etc/init.d/mysql
7. 改变安装目录权限
> cd /usr/local/mysql
> sudo chown -R mysql .
> sudo chgrp -R mysql .
8. 初始化权限表
> sudo bin/mysql_install_db --user=mysql
9. 再次限制访问权限
> sudo chown -R root .
> sudo chown -R mysql var
10. 修改启动脚本配置
> sudo vi /etc/my.cnf
添加启动用户和路径
[mysqld]
user=mysql
port=3306
socket=/var/tmp/mysql.sock
datadir=/usr/local/mysql/var
[mysql.server]
basedir=/usr/local/mysql
11. 运行测试
> sudo /etc/init.d/mysql start
> bin/mysql
mysql> show databases
...
> sudo /etc/init.d/mysql stop
NOTE: 配置过程中缺少PACKAGE - curses
> sudo apt-get intall libncurses5-dev
(search from: http://packages.debian.org)