# groupadd mysql
# useradd -g mysql mysql
# cd /usr/local
# tar xvf mysql-VERSION.tar.gz
# ln –s /usr/local/mysql-VERSION-OS mysql
# cd mysql
# chown –R mysql:mysql .
# scripts/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql data
# bin/mysqld_safe --user=mysql &
上面其实mysql已经安装成功了,但为了方便管理使用,最好进行一下下面的操作
# vim /etc/profile \\把mysql加入搜索路径
export PATH=$PATH:/usr/local/mysql/bin \\在export PATH 。。。。上面添加
# . /etc/profile \\重读一下profile文件
将mysql库文件加入
# vim /etc/ld.so.conf.d/mysql.conf
/usr/local/mysql/lib \\把这句话写在mysql.conf中
# ldconfig -v \\重新导出一下库文件,让系统能够找到mysql的库文件
# ln -sv /usr/local/mysql/include /usr/include/mysql //将mysql的头文件加入到可被搜索的路径中
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld \\将头文件包含在可被搜索的路径中
# chown +x /etc/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
# cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf //为mysql设置主配置文件
# service mysqld restart
OK 成功的配置了mysql ,不过要将mysql开机启动还需要一步(如果你需要开机启动,你就进行下面的步骤。如果不需要就不需要执行下面的步骤)
# vim /etc/rc.d/rc/local
/usr/local/mysql/bin/mysql
现在一切结束。GOOD LUCK !!!