先安装依赖包
yum -y install gcc gcc-c++ cmake ncurses-devel openssl-devel bison
1:tar zxvf mysql-5.5.30.tar.gz
2:yum -y install cmake
3:cd mysql-5.5.30
###mysql5.5开始使用cmake编译了!
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_READLINE=1 \
-DWITH_SSL=bundled \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0
3:make
4:make install
然后启动mysql ,启动过程中遇到的问题
1:/etc/my.cnf中的配置有问题
[ERROR] /usr/local/mysql/bin/mysqld: unknown option '--skip-locking'
mysql5.5中没有该选项,在my.cnf中将该选项删除即可
2:[Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
我在my.cnf中有如下:
#log-slow-queries=/usr/local/mysql/var/slowquery.log ##本来是有这行的,将该行注释掉即可,替换为下面的行
slow-query-log-file=/usr/local/mysql/var/slowquery.log
3:[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
原因:/usr/local/mysql/data目录下的mysql目录下没有文件,只是一个空的目录
解决方法:cd /usr/local/mysql/
./scripts/mysql_install_db --user=mysql & 即可
不要使用绝对路径例如:
cd /usr/local/mysql/scripts/mysql_install_db --user=mysql & 是不行的,会提示出错:
如果指定--basedir=/*/* --datadir=/*/*就可以了!
/data/mysql/scripts/mysql_install_db --user=mysql --basedir=/data/mysql --datadir=/data/mysql/var/ ##这是可以的!
解决了上面的几个问题,即可正常启动!
/usr/local/mysql/bin/mysqld_safe --user=mysql &
mysql5.5安装脚本
[root@localhost lnmp]# cat mysql_install.sh
#!bin/sh
#shell by 2013-1-30
if ! rpm -qa|grep ncurses-devel
then
yum -y install ncurses-devel
fi
if ! rpm -qa|grep openssl-devel
then
yum -y install openssl-devel
fi
MAKE_RUN=$(($(more /proc/cpuinfo | grep processor | wc -l) + 1))
useradd -d /data/mysql mysql
tar zxf mysql-5.5.29.tar.gz
cd mysql-5.5.29
cmake . \
-DCMAKE_INSTALL_PREFIX=/data/mysql/ \
-DMYSQL_USER=mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_ZLIB=system \
-DWITH_LIBWRAP=1 \
-DWITH_INNOBASE_STORAFE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLE_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock
make -j ${MAKE_RUN}
make install
mkdir /data/mysql/var
chmod 755 /data/mysql
chown -R mysql:mysql /data/mysql
/data/mysql/scripts/mysql_install_db --user=mysql --basedir=/data/mysql --datadir=/data/mysql/var/
#mv /etc/my.cnf /etc/my.cnf-`date +%F`
#rm -f /etc/rc.d/init.d/mysqld
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
echo "PATH=$PATH:/data/mysql/bin" >> /etc/profile
echo "export PATH" >> /etc/profile
echo "/data/mysql/lib" >> /etc/ld.so.conf
ldconfig
source /etc/profile
mkdir /data/mysqllog
mkdir /data/mysqllog/binlog
chown -R mysql:mysql /data/mysqllog
cd ..
cp ./my.cnf /etc/my.cnf
阅读(1483) | 评论(0) | 转发(0) |