1.查看Linux 是否安裝了Mysql
[root@localhost zhoulinghong]# rpm -qa |grep MySQL
MySQL-server-community-5.1.22-0.rhel4
已經安裝了。
2.Linux 下安裝mysql(rpm)
[root@localhost zhoulinghong]# rpm -ivh MySQL-server-community-5.1.22-0.rhel4.i386.rpm
warning: MySQL-server-community-5.1.22-0.rhel4.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
error: Failed dependencies:
perl(DBI) is needed by MySQL-server-community-5.1.22-0.rhel4.i386
Suggested resolutions:
perl-DBI-1.40-5.i386.rpm
呵呵,出錯了。Linux的弊端就出現了。安裝軟體的時候相互依賴太強了。。。看到上面錯誤資訊是缺少perl-DBI-1.40-5.i386.rpm包。沒有辦法只能安裝了
3.安裝依賴包
perl-DBI-1.40-5.i386.rpm 這個包在RedHat的CD2中。不用多想掛載光碟機吧。
[root@localhost mnt]# mount /dev/cdrom /mnt/cdrom
掛載成功以後。轉到 /mnt/cdrom/RedHat/RPMS目錄下面就有perl-DBI-1.40-5.i386.rpm 這個包了。
[root@localhost RPMS]# rpm -ivh perl-DBI-1.40-5.i386.rpm
warning: perl-DBI-1.40-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:perl-DBI ########################################### [100%]
安裝成功。
OK,到現在的依賴包也安裝完了,就可以安裝mysql了。(注意:因為大家的環境不一樣,中間可能有其他的依賴包需要安裝,方法照上面就好了。)
4.安裝Mysql
[root@localhost zhoulinghong]# rpm -ihv MySQL-server-community-5.1.22-0.rhel4.i386.rpm
warning: MySQL-server-community-5.1.22-0.rhel4.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-server-community ########################################### [100%]
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'
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
Notes regarding SELinux on this platform:
=========================================
The default policy might cause server startup to fail because it is
not allowed to access critical files. In this case, please update
your installation.
The default policy might also cause inavailability of SSL related
features because the server is not allowed to access /dev/random
and /dev/urandom. If this is a problem, please do the following:
1) install selinux-policy-targeted-sources from your OS vendor
2) add the following two lines to /etc/selinux/targeted/src/policy/domains/program/mysqld.te:
allow mysqld_t random_device_t:chr_file read;
allow mysqld_t urandom_device_t:chr_file read;
3) cd to /etc/selinux/targeted/src/policy and issue the following command:
make load
Starting MySQL[ OK ]
Giving mysqld 2 seconds to start
很明顯,安裝成功了。如果安裝失敗了就卸載一次在安裝一下就基本沒有什麼問題了。