1、yum安装mysql:
[root@localhost Desktop]# cat /etc/yum.repos.d/rhel-local.repo 
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file://"/media/RHEL_6.1 i386 Disc 1"/Server

enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[root@localhost Desktop]# yum install mysql
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
rhel-source                                              | 4.0 kB     00:00 ... 
rhel-source/primary_db                                   | 2.4 MB     00:00 ... 
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql.i686 0:5.1.52-1.el6_0.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package       Arch         Version                   Repository           Size
================================================================================
Installing:
 mysql         i686         5.1.52-1.el6_0.1          rhel-source         898 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 898 k
Installed size: 2.3 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql-5.1.52-1.el6_0.1.i686                                  1/1 
duration: 712(ms)
Installed products updated.

Installed:
  mysql.i686 0:5.1.52-1.el6_0.1                                                 

Complete!
[root@localhost Desktop]#

[root@localhost Desktop]# yum install mysql-server
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.i686 0:5.1.52-1.el6_0.1 will be installed
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.52-1.el6_0.1.i686
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.52-1.el6_0.1.i686
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.52-1.el6_0.1.i686
--> Running transaction check
---> Package perl-DBD-MySQL.i686 0:4.013-3.el6 will be installed
---> Package perl-DBI.i686 0:1.609-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                                 Arch                          Version                                    Repository                            Size
=============================================================================================================================================================
Installing:
 mysql-server                            i686                          5.1.52-1.el6_0.1                           rhel-source                          8.3 M
Installing for dependencies:
 perl-DBD-MySQL                          i686                          4.013-3.el6                                rhel-source                          134 k
 perl-DBI                                i686                          1.609-4.el6                                rhel-source                          707 k

Transaction Summary
=============================================================================================================================================================
Install       3 Package(s)

Total download size: 9.1 M
Installed size: 25 M
Is this ok [y/N]: y
Downloading Packages:
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                         28 MB/s | 9.1 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : perl-DBI-1.609-4.el6.i686                                                                                                                 1/3 
  Installing : perl-DBD-MySQL-4.013-3.el6.i686                                                                                                           2/3 
  Installing : mysql-server-5.1.52-1.el6_0.1.i686                                                                                                        3/3 
duration: 454(ms)
Installed products updated.

Installed:
  mysql-server.i686 0:5.1.52-1.el6_0.1                                                                                                                       

Dependency Installed:
  perl-DBD-MySQL.i686 0:4.013-3.el6                                                perl-DBI.i686 0:1.609-4.el6                                               

Complete!
 
2、cp安装目录下的mysql所有文件到新目录:
[root@localhost lib]# cp mysql/* mysql_3307/
cp: omitting directory `mysql/mysql'
cp: cannot open `mysql/mysql.sock' for reading: No such device or address
cp: omitting directory `mysql/test'
[root@localhost lib]# /etc/init.d/mysqld stop
Stopping mysqld:                                           [  OK  ]
[root@localhost lib]# cp mysql/* mysql_3307/
cp: overwrite `mysql_3307/ibdata1'? y
cp: overwrite `mysql_3307/ib_logfile0'? y
cp: overwrite `mysql_3307/ib_logfile1'? y
cp: omitting directory `mysql/mysql'
cp: omitting directory `mysql/test'
[root@localhost lib]# 

3、安装实例:
[root@localhost Desktop]# mysql_install_db  --datadir=/var/lib/mysql_3307 --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!