日期:2014-05-16 浏览次数:20732 次
通过配置将Redhat使用CentOS的yum库。
从拖管方那拿到服务器后发现里面已经存在了数据库,
但是通过rpm -qa | grep mysql却无法找到已经安装的数据库
通过find / -name mysql 发现如下结果:
[root@HOHO ~]# find / -name mysql /usr/local/mysql /usr/local/mysql/include/mysql /usr/local/mysql/lib/mysql /usr/local/mysql/var/mysql /usr/local/mysql/share/mysql /usr/local/mysql/bin/mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql /usr/lib64/mysql /var/lib/mysql /var/lib/mysql/mysql
运行/usr/local/mysql/bin/mysql --version发现客户端是5.0老版本的,于是想到删除老的mysql
?由于没有rpm包,所以无法通过rpm -e --nodeps mysql来删除mysql包
只好通过如下方式删除:
[root@HOHO ~]# rm -rf /usr/local/mysql/ [root@HOHO ~]# find / -name mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql /usr/lib64/mysql /var/lib/mysql /var/lib/mysql/mysql [root@HOHO ~]# ll /usr/lib64/mysql/ 总计 4 drwxr-xr-x 3 root root 4096 07-20 10:55 plugin [root@HOHO ~]# rm -rf /var/lib/mysql/ [root@HOHO ~]# find / -name mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql /usr/lib64/mysql
?删除成功后,打算用yum install mysql安装,装完后发现版本还不是最新的5.5.14,
所以又通过yum remove mysql删除。
从mysql.com官网下载以下三个文件:
(1)MySQL-server-5.5.14-1.rhel5.x86_64
(2)MySQL-shared-5.5.14-1.rhel5.x86_64
(3)MySQL-client-5.5.14-1.rhel5.x86_64
按照以上顺序,安装如下:
[root@HOHO ~]# rpm -Uvh MySQL-server-5.5.14-1.rhel5.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-server ########################################### [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 uhz000153.hichina.com 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. Please report any problems with the /usr/bin/mysqlbug script! [root@HOHO ~]# find / -name mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql /usr/lib64/mysql /usr/share/mysql /etc/logrotate.d/mysql /etc/rc.d/init.d/mysql /var/lib/mysql /var/lib/mysql/mysql [root@HOHO ~]# find / -name mysqladmin [root@HOHO ~]# rpm -Uvh MySQL-shared-5.5.14-1.rhel5.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-shared ########################################### [100%] [root@HOHO ~]# find / -name mysqladmin [root@HOHO ~]# find / -name mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql /usr/lib64/mysql /usr/share/mysql /etc/logrotate.d/mysql /etc/rc.d/init.d/mysql /var/lib/mysql /var/lib/mysql/mysql [root@HOHO ~]# rpm -Uvh MySQL-client-5.5.14-1.rhel5.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-client ########################################### [100%] [root@HOHO ~]# find / -name mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql /usr/lib64/mysql /usr/share/mysql /usr/bin/mysql /etc/logrotate.d/mysql /etc/rc.d/init.d/mysql /var/lib/mysql /var/lib/mysql/mysql [root@HOHO ~]#
?注意:如果安装过程中出错,有可能是原来的没有删干净造成的,再find下,再rm下就好。
?
安装