1、 到http://mysql.cs.pu.edu.tw/Downloads/MySQL-5.1/mysql-5.1.36.tar.gz下载源码包
2、 增加用户及用户组
[root@rac2 mysql-5.1.36]# groupadd mysql
[root@rac2 mysql-5.1.36]# useradd -g mysql mysql
3、 解压mysql-5.1.36.tar.gz
gzip -d < mysql-5.1.36.tar.gz | tar -xvf –
4、 configure工具来编译源码,源码安装比较灵活,这里我们安装在/usr/local/mysql目录下,编译的时间有点长
[root@rac2 mysql-5.1.36]#./configure –prefix=/usr/local/mysql
[root@rac2 mysql-5.1.36]#make
[root@rac2 mysql-5.1.36]#make install
5、 准备配置文件
cp support-files/my-medium.cnf /etc/my.cnf
或touch /etc/mysql.cnf自己编写
6、 创建系统数据库及系统表
[root@rac2 mysql-5.1.36]# cd /usr/local/mysql
[root@rac2 mysql]# bin/mysql_install_db –user=mysql
7、 设置相应目录权限
[root@rac2 mysql]# chown -R root .
[root@rac2 mysql]# chown -R mysql var
[root@rac2 mysql]# chgrp -R mysql .
8、启动mysql
[root@rac2 mysql]# bin/mysqld_safe –user=mysql &
[1] 13480
[root@rac2 mysql]# 090723 19:15:24 mysqld_safe Logging to ‘/usr/local/mysql/var/rac2.err’.
090723 19:15:24 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
[root@rac2 mysql]# bin/mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.36-log Source distributionType ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> show engines;
+————+—————————————+—–+————+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+————+———+————————————–+————–+——+————+
| CSV | YES | CSV storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+————+———+——————+————–+——+————+
4 rows in set (0.01 sec)
参考《深入浅出mysql》一书