bitsCN.com
从mysql-cluster-gpl-7.2.8.tar.gz来安装mysql5.5.27
#! /bin/sh
# install mysql 5.5.27 through mysql-cluster-gpl-7.2.8.tar.gz
# add path
mkdir -p /var/lib/mysql
# add data path
mkdir -p /var/lib/data/mysql
# groupadd mysql
# useradd -g mysql mysql
chown -R mysql:mysql /var/lib/
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 bison cmake
cp /home/guanli/mysql-cluster-gpl-7.2.8.tar.gz /var/lib
cd /var/lib
tar -zvxf mysql-cluster-gpl-7.2.8.tar.gz
mv mysql-cluster-gpl-7.2.8 mysql5.5.27
cd mysql5.5.27
# rm CMakeCache.txt
cmake -DCMAKE_INSTALL_PREFIX=/var/lib/mysql -DMYSQL_DATADIR=/var/lib/data/mysql -DINSTALL_SBINDIR=/var/lib/mysql/sbin -DSYSCONFDIR=/etc -DINSTALL_PLUGINDIR=/var/lib/mysql/lib64/mysql/plugin -DINSTALL_MANDIR=/var/lib/mysql/share/man -DINSTALL_SHAREDIR=/var/lib/mysql/share -DINSTALL_LIBDIR=/var/lib/mysql/lib64/mysql -DINSTALL_INCLUDEDIR=/var/lib/mysql/include/mysql -DINSTALL_INFODIR=/var/lib/mysql/share/info -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/var/lib/data/mysql/mysql.sock -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EMBEDDED_SERVER=1 -DMYSQL_USER=mysql -DWITH_DEBUG=0 -DENABLE_PROFILING=0 -DWITH_COMMENT='string'
make && make install
cp support-files/my-medium.cnf /etc/my.cnf
# chmod a+rwx /scripts/mysql_install_db
./scripts/mysql_install_db --user=mysql --basedir=/var/lib/mysql --datadir=/var/lib/data/mysql
# /var/lib/mysql/bin/mysqld_safe & 目前启动不了,有好多问题,待更新。
问题1:在利用cmake编译的时候,该用相对路径的时候必须用相对路径,不能用绝对路径,否则会出错。
解决办法:将配置命令改为:
cmake -DCMAKE_INSTALL_PREFIX=/var/lib/mysql -DMYSQL_DATADIR=/var/lib/data/mysql -DINSTALL_SBINDIR=sbin -DSYSCONFDIR=/etc -DINSTALL_PLUGINDIR=lib64/mysql/plugin -DINSTALL_MANDIR=share/man -DINSTALL_SHAREDIR=share -DINSTALL_LIBDIR=lib64/mysql -DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_INFODIR=share/info -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/var/lib/data/mysql/mysql.sock -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EMBEDDED_SERVER=1 -DMYSQL_USER=mysql -DWITH_DEBUG=0 -DENABLE_PROFILING=0 -DWITH_COMMENT='string'
问题2:121212 01:55:07 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql/data /var/lib/mysql/sbin/mysqld: File './mysql-bin.index' not found (Errcode: 13) 121212 1:55:08 [ERROR] Aborting
解决:权限问题。# chown -R mysql:mysql /var/lib/
bitsCN.com