redhat安装mysql备忘

chmod 755 mysql-5.0.45.tar.gz
# tar -zxvf mysql-5.0.45.tar.gz -C /usr/src/
# cd /usr/src/mysql-5.0.45
# ./configure --prefix=/usr/local/mysql --with-charset=gbk --localstatedir=/usr/local/mysql/data
# make
# make install
# groupadd mysql
# useradd mysql -g mysql
# cd /usr/local/mysql/bin
# ./mysql_install_db --user=mysql

# cd /usr/local/mysql
# chown -R root .
# chown -R mysql data
# chown -R mysql data/ .
# chown -R mysql data/mysql/ .
# chgrp -R mysql .
# /usr/local/mysql/bin/mysqld_safe --user=mysql &
# netstat -tnl |grep 3306
# /usr/local/mysql/bin/mysql -uroot -p
# show database;
# /usr/local/mysql/bin/mysqladmin -uroot password 6220104
# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
# cd /etc/init.d/
# chmod +x mysqld
# chkconfig mysqld
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
# service mysqld stop

# cp /usr/local/mysql/bin/* /usr/bin/

到此mysql-5.0.45 安装完成。