---
title: "RHEL4下安装MySQL"
author: "iammonster"
date: "2008-11-24T12:58:11Z"
tags: []
slug: "rhel4-mysql"
draft: false
lastmod: "2008-11-25T18:44:14Z"
id: 275902
url: "https://jiajun.iteye.com/blog/275902"
---

1、下载服务器端及客户端两个文件：

1. ```
   wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-server-community-5.1.29-0.rhel4.x86_64.rpm/from/http://mysql.ntu.edu.tw/
   wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-client-community-5.1.29-0.rhel4.x86_64.rpm/from/http://mysql.ntu.edu.tw/
   
   ```
   
   [你也可以到这里下载你需要的版本http://dev.mysql.com/downloads/mysql/5.1.html#linux-rhel4-x86-64bit-rpms](http://dev.mysql.com/downloads/mysql/5.1.html#linux-rhel4-x86-64bit-rpms)

2、安装客户端

    如果已经安装某个版本的MySql则卸载：

```
# rpm -qa|grep mysql
mysqlclient10-3.23.58-4.RHEL4.1
mysql-4.1.20-1.RHEL4.1
# rpm -e mysqlclient10-3.23.58-4.RHEL4.1
# rpm -e mysql-4.1.20-1.RHEL4.1
```

 

由于，没有注册码，不能安装上面下载的RPM包，只好下载非RPM包来安装，下面拷自官方文档：

 

安装步骤

```
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
```

 

  自动启动：

```
If you install MySQL from a source distribution or using a binary distribution format that does not install mysql.server automatically, 
you can install it manually. The script can be found in the support-files directory under the MySQL installation directory or in a 
MySQL source tree.

To install mysql.server manually, copy it to the /etc/init.d directory with the name mysql, 
and then make it executable. Do this by changing location into the appropriate directory 
where mysql.server is located and executing these commands:

shell> cp mysql.server /etc/init.d/mysql
shell> chmod +x /etc/init.d/mysql

shell> chkconfig --add mysql
```

 

虽然成功，尚待整理总结。