從mysql-cluster-gpl-7.2.8.tar.gz來安裝mysql5.5.27 #! /bin/sh www.2cto.com # 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編譯的時候,該用相對路徑的時候必須用相對路徑,不能用絕對路徑,否則會出錯。 www.2cto.com 解決辦法:將配置命令改為: 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/