useradd -g mysql mysql
MYSQLFILE="mysql-5.1.24-rc.tar.gz"
tar -zvxf $MYSQLFILE
cd mysql-5.1.24-rc
'./configure' \
'--prefix=/usr/local/mysql' \
'--with-charset=utf8' \
'--with-extra-charsets=latin1,gbk,gb2312,ascii,big5'
make
make install
cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
bin/mysql_install_db --user=mysql
chown -R root .
chown -R mysql var
#到此处已安装完成。可启动mysql:/usr/local/mysql/bin/mysqld_safe --user=mysql &
#关闭mysql:/usr/local/mysql/bin/mysqladmin -p shutdown
# 如下为添加mysql至服务
cp mysql-5.1.24-rc/support-files/mysql.server /etc/rc.d/init.d/mysqld
LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/mysql/lib
export LD_LIBRARY_PATH
PATH=$PATH:.:/usr/local/mysql/bin
export PATH
编译安装出现如下错误
checking "character sets"... default: utf8, collation: utf8_general_ci; compiled in: utf8 latin1 utf8 latin1 gbk gb2312 ascii big5
checking whether to compile national Unicode collations... yes
checking for doxygen... no
checking for pdflatex... no
checking for makeindex... no
checking whether build environment is sane... yes
checking whether make sets $(MAKE)... (cached) yes
checking for gawk... (cached) gawk
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.The solution is simple, run one of the following commands to install a C compiler:
未安装c语言编译环境!
解决办法:
CentOS: yum -y install gcc
Fedora: up2date -i gcc
./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=latin1,gbk,gb2312,ascii,big5
make[1]: Entering directory `/usr/local/software/tools/mysql-5.1.52/mysys'
source='my_new.cc' object='my_new.o' libtool=no
DEPDIR=.deps depmode=none /bin/sh ../depcomp
g++ -DDEFAULT_BASEDIR="/usr/local/mysql" -DMYSQL_DATADIR=""/usr/local/mysql/var"" -
DDEFAULT_CHARSET_HOME=""/usr/local/mysql"" -DSHAREDIR=""/usr/local/mysql/share/mysql"" -DDEFAULT_HOME_ENV=MYSQL_HOME -
DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR=""/usr/local/mysql/etc"" -DHAVE_CONFIG_H -I. -I../include
-I../include -I../include -I. -O -fno-implicit-templates -fno-exceptions -fno-rtti -c -o my_new.o my_new.cc
../depcomp: line 571: exec: g++: not found
make[1]: *** [my_new.o] Error 127
make[1]: Leaving directory `/usr/local/software/tools/mysql-5.1.52/mysys'
make: *** [all-recursive] Error 1
../depcomp: line 571: exec: g++: not found 提示这个是缺少:gcc-c++-3.4.6-3.i386.rpm
yum -y install gcc-c
3../include/my_global.h:909: error: redeclaration of C++ built-in type `bool'
make[2]: *** [my_new.o] Error 1
make[2]: Leaving directory `/home/tools/mysql-5.0.22/mysys'
make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/mysql-5.1' make: *** [all] Error 2
yum -y install ncurses-devel
根据提示安装累得半死,后来直接找到依赖包全部安装就好了!
依赖的开发包安装
yum -y install gcc glib gcc-c++ esound-devel ncurses-devel