在Centos 5.4上安装社区版Mysql5.1.41
安装Mysql服务,提供公司内部应用系统数据库服务。
PC机环境:IntelE5300 内存4G 硬盘500G
操作系统:Linux Centos 5.4
IP:192.168.0.23
2. 安装准备
shell>yum update –y
shell>yum –y install gcc gcc-c++ perl libtool ncurses-devel
shell>groupadd mysql
shell>useradd -g mysql mysql
3. 安装
shell>cd /tmp
shell>wgethttp://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.41.tar.gz/from/http://mirror.trouble-free.net/mysql_mirror/
shell>tar zxvf mysql-5.1.41.tar.gz
shell>cd mysql-5.1.41
shell>./configure --prefix=/usr/local/mysql --without-debug--with-extra-charsets=all --with-charset=utf8 --exec-prefix=/usr/local/mysql--with-pthread --enable-assembler --enable-thread-safe-client--with-mysqld-user=mysql --with-plugins=all --with-client-ldflags=-all-static--with-mysqld-ldflags=-all-static --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
shell>make
shell>make install
注:
ec2 安装mysql参考:错误:/usr/bin/ld: cannot find –lncursesw
解决:yum install ncurses-static --with-client-ldflags="-all-static-ltinfo"(configure参数)
注 :make报错
ERROR 1 : checking for termcap functions library...configure: error: No curses/termcap library found
解决办法:
Shell>yum list|grep ncurses
Shell>yum -y install ncurses-devel
Shell>yum install ncurses-devel
ERROR 2: checking for termcap functions library... configure: error: No curses/termcaplibrary found
解决办法:
Shell>yum list|grep ncurses
Shell>yum -y install ncurses-devel
Shell>yum install ncurses-devel
在/tmp/mysql-5.1.53/目录下
Shell>yum install automake autoconf libtool
Shell>autoreconf --force --install
Shell>libtoolize --automake --force
Shell>automake --force --add-missing
shell>cd /usr/local/mysql
shell>bin/mysql_install_db --user=mysql
shell>chown -R root:mysql .
shell>chown -R mysql /usr/local/mysql
shell>chgrp -R mysql .
shell>cp share/mysql/my-huge.cnf /etc/my.cnf
shell>ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
shell>ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/
shell>ln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/
shell>ln -s /usr/local/mysql/share/mysql/mysql.server/usr/bin/
shell>ln -s /usr/local/mysql/bin/mysqldump /usr/bin/
4. 安装后配置
4.1. 设置mysql自动启动脚本
shell>cd /usr/local/mysql
shell>cp ./share/mysql/mysql.server /etc/rc.d/init.d/mysqld
shell>chmod 755 /etc/rc.d/init.d/mysqld
shell>chkconfig –-add mysqld
shell>chkconfig –-level 345 mysqld on
可以使用以下命令启停mysql服务或查看当前mysql服务状态
shell>/etc/init.d/mysqld start
shell>/etc/init.d/mysqld stop
shell>/etc/init.d/mysqld status
4.2. 设置root密码
shell>/usr/local/mysql/bin/mysqladmin –u root password‘password’
4.3. 安装DBI和DBD
由于需要使用mysqlhotcopy,需要安装以下部分:
n DBI
shell>cd /tmp
shell>wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.609.tar.gz
shell>tar xzvf DBI-1.609.tar.gz
shell>cd DBI-1.609
shell>perl Makefile.PL
shell>make
shell>make install
n DBD::mysql
shell>cd /tmp
shell>wget http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.013.tar.gz
shell>PATH=$PATH:/usr/local/mysql/bin;export PATH
shell>LD_LIBRARY_PATH=/usr/l