配置Mysql:
1、安装 mysql 到指定目录再用源码包安装。
[root@localhost media]# tar -zxvf mysql-5.0.56.tar.gz -C /usr/src/
mysql-5.0.56/win/data/mysql/time_zone.frm
mysql-5.0.56/win/data/mysql/time_zone.MYI
mysql-5.0.56/win/data/mysql/time_zone.MYD
mysql-5.0.56/win/data/mysql/time_zone_transition.frm
mysql-5.0.56/win/data/mysql/time_zone_transition.MYI
mysql-5.0.56/win/data/mysql/time_zone_transition.MYD
mysql-5.0.56/win/data/mysql/time_zone_transition_type.frm
mysql-5.0.56/win/data/mysql/time_zone_transition_type.MYI
mysql-5.0.56/win/data/mysql/time_zone_transition_type.MYD
mysql-5.0.56/win/data/mysql/time_zone_leap_second.frm
mysql-5.0.56/win/data/mysql/time_zone_leap_second.MYI
mysql-5.0.56/win/data/mysql/time_zone_leap_second.MYD
mysql-5.0.56/win/data/mysql/proc.frm
mysql-5.0.56/win/data/mysql/proc.MYI
mysql-5.0.56/win/data/mysql/proc.MYD
mysql-5.0.56/win/data/mysql/procs_priv.frm
mysql-5.0.56/win/data/mysql/procs_priv.MYI
mysql-5.0.56/win/data/mysql/procs_priv.MYD
mysql-5.0.56/win/data/test/
2、配置、编译、安装Mysql服务 (编译安装期间时间较长,耐心等待)
[root@localhost /]# cd /usr/src/mysql-5.0.56/
[root@localhost mysql-5.0.56]# ./configure --prefix=/usr/local/mysql && make && make install
make[4]: Nothing to be done for `install-data-am'.
make[4]: Leaving directory `/usr/src/mysql-5.0.56/server-tools/instance-manager'
make[3]: Leaving directory `/usr/src/mysql-5.0.56/server-tools/instance-manager'
make[3]: Entering directory `/usr/src/mysql-5.0.56/server-tools'
make[4]: Entering directory `/usr/src/mysql-5.0.56/server-tools'
make[4]: Nothing to be done for `install-exec-am'.
make[4]: Nothing to be done for `install-data-am'.
make[4]: Leaving directory `/usr/src/mysql-5.0.56/server-tools'
make[3]: Leaving directory `/usr/src/mysql-5.0.56/server-tools'
make[2]: Leaving directory `/usr/src/mysql-5.0.56/server-tools'
make[1]: Leaving directory `/usr/src/mysql-5.0.56'
编译成功
3、创建运行Mysql的系统用户和组
[root@localhost mysql-5.0.56]# useradd -M -s /sbin/nologin mysql
4、建立配置文件
[root@localhost mysql-5.0.56]# cp support-files/my-medium.cnf /etc/my.cnf
5、初始化数据库
[root@localhost mysql-5.0.56]# /usr/local/mysql/bin/mysql_install_db --user=mysql
The latest information about MySQL is available on the web at
http://www.mysql.com
Please consult the MySQL manual section: 'Problems running mysql_install_db',
and the manual section that describes problems on your OS.
Another information source is the MySQL email archive.
Please check all of the above before mailing us!
And if you do mail us, you MUST use the /usr/local/mysql/bin/mysqlbug script!
[root@localhost mysql-5.0.56]# chown -R root.mysql /usr/local/mysql/
[root@localhost mysql-5.0.56]# chown -R mysql /usr/local/mysql/var/
6、调整lib库路径
[root@localhost mysql-5.0.56]# echo "/usr/local/mysql/lib/mysql/" >> /etc/ld.so.conf
[root@localhost mysql-5.0.56]# ldconfig
7、使用mysqld_safe脚本安全启动服务
[root@localhost mysql-5.0.56]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[2] 7657
8、将mysqld 添加为系统服务
[root@localhost mysql-5.0.56]# cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql-5.0.56]# chmod +x /etc/init.d/mysqld
[root@localhost mysql-5.0.56]# chkconfig --add mysqld
[root@localhost mysql-5.0.56]# chkconfig mysqld on
9、设置Mysql的执行路径
[root@localhost mysql-5.0.56]# export PATH=$PATH:/usr/local/mysql/bin/
[root@localhost mysql-5.0.56]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
10、安装完成、登陆测试
[root@localhost mysql-5.0.56]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.56-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>