首先要下载MySQL的源代码
wget http://mirror.provenscaling.com/mysql/community/source/5.0/mysql-5.0.16.tar.gz
下载好后,解压
tar zxvf mysql-5.0.16.tar.gz
然后安装编译MySQL的库文件
yum -y install gcc gcc-c++ ncurses-devel libtool-libs//这东西我想了好久才想起来,其实编译的时候会有提示缺什么的
然后按顺序执行以下命令
cd mysql-5.0.16./configure --prefix=/usr/local/mysql \--enable-thread-safe-client \--enable-assembler \--enable-profiling \--with-mysqld-ldflags=-all-static \--with-client-ldflags=-all-static \--with-charset=utf8 \--with-extra-charsets=all \--with-plugins=max \--with-mysqld-user=mysql \--localstatedir=/usr/local/mysql/datamakemake install
等待10几分钟,安装完成后,复制配置文件
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
设置权限
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R mysql:mysql /usr/local/mysql
建立连接符号
ln -s /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqldln -s /usr/local/mysql/bin/mysql /usr/binln -s /usr/local/mysql/bin/mysqladmin /usr/bin
现在可以启动了
service mysqld start//设置开机启动chkconfig --add mysqldchkconfig --level 345 mysqld on//设置mysql的密码/usr/local/mysql/bin/mysqladmin -u root password 123456 (123456为root密码)
好了,一切OK 。
参考: