tar zxvf mysql-5.1.35.tar.gz
cd mysql-5.1.35
groupadd mysql
useradd -g mysql mysql
./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=utf8,gb2312,big5 --enable-thread-safe-client
 
./configure -prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=utf8,gb2312,big5 --enable-thread-safe-client --with-plugins=innobase
 
make
make install
cp /home/soft/my.cnf /etc/my.cnf
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
scripts/mysql_install_db --user=mysql
chkconfig --add mysqld
chkconfig --level 123456 mysqld on
安装完以后要初始化数据库
cd /usr/local/mysql
/usr/local/mysql/bin/mysql_install_db --user=mysql
/usr/local/mysql/bin/mysqld_safe  --user=root&
                        /home/soft/mysql-
5.1.35/scripts/mysql_install_db --user=mysql
chown -R mysql var
chgrp -R mysql .
启动mysql
chmod +x /etc/init.d/mysqld
/etc/init.d/mysqld start
或/usr/local/mysql/share/mysql/mysql.server start
ss -ant | grep 3306
为了能让系统找到mysql,请运行如下命令
vi /etc/profile
增加
export PATH=$PATH:/usr/local/mysql/bin
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig