CentOS 5.5 编译安装MySQL 5.5.10
MySQL 5.5.10 for Linux 安装
操作系统:CentOS 5.5
MySQL:5.5.10
sudo -s
LANG=C
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
#先下载cmake
wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
#安装cmake
tar xvzf cmake-2.8.4.tar.gz
./configure
make
make install
#创建mysql用户名及组
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
#下载最新的mysql
wget ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.5/mysql-5.5.10.tar.gz
#解压
tar zxvf mysql-5.5.10.tar.gz
cd mysql-5.5.10
#开始编译并安装
/usr/local/bin/cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql/ -DMYSQL_DATADIR=/usr/local/webserver/mysql/data -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/usr/local/webserver/mysql/data/mysql.sock -DMYSQL_USER=mysql -DWITH_DEBUG=0
make && make install
chmod +w /usr/local/webserver/mysql
chown -R mysql:mysql /usr/local/webserver/mysql
cp support-files/my-small.cnf /etc/my.cnf
chown mysql:mysql /etc/my.cnf
执行下面的
/usr/local/webserver/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/webserver/mysql --datadir=/usr/local/webserver/mysql/data
在/etc/my.cnf 打开下面的InnoDB配置以减少内存即可:
default-storage-engine=MyISAM
server-id = 1
innodb_buffer_pool_size = 21M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
启动:带--user=mysql
/usr/local/webserver/mysql/bin/mysqld_safe --user=mysql