2012年(39)
分类:
2012-04-06 11:38:09
原文地址:Mysql5编译安装 作者:unixsly
安装:mysql-5.1.52.tar.gz 到 下载个:MySQL-devel-5.1.52-1.glibc23.i386.rpm (安装这个就可以解决类似要yum install php-mysql这样的问题),再下载安装了个MySQL-shared-5.1.52-1.glibc23.i386.rpm(这个在编译php的时候会用到)。如果没有会出现如下错误:gcc: /usr/lib/mysql/libmysqlclient.so: No such file or directory 。
下载个 MySQL-shared-5.1.52-1.glibc23.i386.rpm
ln -s /usr/lib/libmysqlclient.so /usr/lib/mysql/libmysqlclient.so 就OK了。
yum -y install ntp
ntpdate time.nist.gov
vi /etc/ld.so.conf
添加/usr/lib
ldconfig
mkdir -p /data/mysql/data
groupadd mysql
useradd -g mysql -d /data/mysql -s /sbin/nologin mysql
chown -R mysql.mysql /data/mysql
[root@Master ~]# tar -zxvf mysql-5.1.52.tar.gz
./configure \
--prefix=/usr/local/mysql/ \
--localstatedir=/data/mysql/data \
--with-mysqld-user=mysql \
--enable-assembler \
--without-debug \
--with-extra-charsets=complex \
--with-big-tables \
--with-readline \
--with-ssl \
--enable-local-infile \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--with-plugins=partition,innobase,myisammrg
make && make install
chown -R mysql.mysql /usr/local/mysql
cp support-files/my-huge.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig --add mysqld
cd /usr/local/mysql/bin
for i in *; do ln -s /usr/local/mysql/bin/$i /usr/bin/$i; done /变成系统环境变量
mysqladmin -uroot -p password 123456 /修改root密码