1.下載源碼包
wget http://mysql.llarian.net/Downloads/MySQL-5.1/mysql-5.1.63.tar.gz
2.解壓
tar zvxf ./mysql-5.1.63.tar.gz
3.配置configure
./configure --prefix=/usr/local/mysql
--with-charset=utf8
--with-extra-charsets=all
--with-tcp-port=3306
--with-unix-socket-path=/tmp/mysql.sock
--with-mysqld-user=mysqld
--with-federated-storage-engine
--with-mysqld-user=mysqld
--with-plugins=innobase,myisam
--enable-assembler
--without-isam
--with-client-ldflags=-all-static
{
出現checking for termcap functions library... configure: error: No curses/termcap library found
curses/termcap 库没有安装
下載wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
解压 tar zxvf ncurses-5.9.tar.gz
进入目录 sudo ./configure --prefix=/usr --with-shared --without-debug
编译,安装 make , make install
}
4.編譯,安裝
make
make install
5.创建用户和组.配置
groupadd mysql
useradd -g mysql mysql
cp support-files/my-media.cnf /etc/my.cnf
mkdir /usr/local/mysql/var
修改MySQL 数据目录的 ownership
chown -R mysql /usr/local/mysql /usr/lib/mysql /usr/share/mysql
chgrp -R mysql /usr/local/mysql /usr/lib/mysql /usr/share/mysql
6.安装,启动,进入数据库.
/usr/local/mysql/bin/mysql_install_db
/user/local/mysql/bin/mysqld_safe
/user/local/mysql/bin/mysql -u root
7.添加启动项
mv /usr/local/mysqlshare/mysql/mysql.server /etc/init.d/mysql
chmod 775 /etc/init.d/mysql
chkconfig --add mysql