安装
编译环境前提(mysql 5.5.x 不再用 configure,而用cmake)
wget http://lnamp-web-server.googlecode.com/files/cmake-2.8.4.tar.gz tar zxvf cmake-2.8.4.tar.gz cd cmake-2.8.4 ./configure && make && make install
安装mysql
wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.35.tar.gz tar zxvf mysql-5.5.35.tar.gz
cd mysql-5.5.35
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql
-DMYSQL_DATADIR=/data/mysql/data
-DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DENABLED_LOCAL_INFILE=1
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all
-DMYSQL_TCP_PORT=3306
make
make install
配置
# groupadd mysql # useradd -r -g mysql mysql # cd /usr/local/webserver/mysql # chown -R mysql . # chgrp -R mysql . # scripts/mysql_install_db --user=mysql # chown -R root . # chown -R mysql data # Next command is optional # cp support-files/my-default.cnf /etc/my.cnf # bin/mysqld_safe --user=mysql &
修改mysql.server脚本
将 basedir= datadir= 改为 basedir=/usr/local/webserver/mysql datadir=/usr/local/webserver/mysql/data
配置启动脚本
cd /usr/local/webserver/mysql
cp support-files/mysql.server /etc/init.d/mysql
启动mysql
service mysql start
service mysql stop
service mysql restart