要安装 GNU perl gcc-c++ make
下载相关包:
wget http://mysql.he.net/Downloads/MySQL-5.5/mysql-5.5.25a.tar.gz
wget http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz
wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
安装包:
tar xvzf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./bootstrap
gmake
gmake install
cd ..
tar zxvf bison-2.5.tar.gz
cd bison-2.5
./configure
make
make install
cd ..
增加用户
groupadd mysql
useradd -g mysql mysql -d /dev/null -s /sbin/nologin
开始安装Mysql 5.5
tar zxvf mysql-5.5.25a.tar.gz
cd mysql-5.5.25a
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/var/mysql/data
发果报错,
yum install ncurses-devel
rm CMakeCache.txt
继续安装即可
make
make install
chmod +w /opt/mysql
chown -R mysql:mysql /opt/mysql
cd support-files/
cp my-huge.cnf /opt/mysql/my.cnf
cp my-huge.cnf /etc/my.cnf
cp mysql.server /etc/init.d/mysqld
/opt/mysql/scripts/mysql_install_db --defaults-file=/opt/mysql/my.cnf --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql
chmod +x /etc/init.d/mysqld
vi /etc/init.d/mysqld 修改以下内容
basedir=/opt/mysql
datadir=/opt/mysql/data
加入开机启动
chkconfig --add mysqld
chkconfig --level 345 mysqld on
可以启动了
service mysqld restart