编译安装mysql及问题汇总


编译安装mysql

groupadd mysql
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

chmod 775 /etc/rc.d/init.d/mysqld
chkconfig –add mysqld
然后启动即可--service mysqld start   自启动:chkconfig --level 35 mysqld on
添加至环境变量:
vi /etc/profile
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 whether make sets $(MAKE)... yes
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





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值