引用:http://www.2cto.com/database/201107/98316.html
安装
# groupadd mysql
# useradd -g mysql mysql
解压编译
# tar -zxvf mysql-5.0.22.tar.gz
# cd mysql-5.0.22
# ./configure --prefix=/usr/local/mysql --with-charset=gbk
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
设置自启动
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 700 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
数据库初始化
# cd /usr/local/mysql
# /usr/local/mysql/bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# /usr/local/mysql/bin/mysqld_safe --user=mysql &
启动数据库 建立快捷方式
# /etc/rc.d/init.d/mysqld start
# ln -s /usr/local/mysql/bin/mysql /sbin/mysql
# ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin
# PATH=$PATH:/usr/local/mysql/bin
# export PATH
# echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
# ldconfig
重启
#reboot
给root加个密码123456。
键入以下命令 :
]# /usr/bin/mysqladmin -u root password 123456
测试数据库
#mysql -u root -p123456
出现
mysql>
安装成功。