分类: Mysql/postgreSQL
2011-10-28 16:39:19
Red Hat Enterprise Linux Server release 5.4 (Tikanga) x64
安装cmake
yum install cmake
建立程序目录
mkdir /usr/local/mysql5.5
添加用户
groupadd mysql
useradd -r -g mysql mysql
安装mysql
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5/ \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0 \
make
make install
其他编译参数
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5/ \
-DMYSQL_DATADIR=/var/mysql\
-DMYSQL_UNIX_ADDR=/var/mysql/mysqld.sock \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_TCP_PORT=3306 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8-general_ci \
-DMYSQL_UNIX_ADDR=/var/mysql/mysql.sock \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0
修改权限 (进到 安装目录)
chown -R mysql .
chgrp -R mysql .
chown mysql.mysql -R data
初始化数据库 (进到 安装目录)
./scripts/mysql_install_db --user=mysql --defaults-file=/usr/local/mysql5.5/etc/my.cnf
复制配置文件
cp support-files/my-medium.cnf etc/my.cnf
复制启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
设置mysqld的开机启动
# cp support-files/mysql.server /etc/init.d/mysql
# chmod 755 /etc/init.d/mysql
# chkconfig mysql on
/usr/local/mysql5.5/bin/mysqld_safe --defaults-file=/usr/local/mysql5.5/etc/my.cnf --user=mysql &
/usr/local/mysql5.5/bin/mysqladmin shutdown