rpm怎么卸载mysql5.6_redhat下安装mysql 5.6.20,解压zip包,查看已经安装过的mysql,卸载rpm安装包,安装mysql服务器端和客户端,修改mysql用户名,登陆mys...

本文详细介绍了在Redhat系统中如何卸载旧版MySQL,包括使用`rpm`命令卸载相关组件,手动删除遗留文件,以及安装MySQL5.6服务器端和客户端的完整过程。此外,还提到了修改MySQL初始密码的方法。
摘要由CSDN通过智能技术生成



1 将相关的

mysql rpm

包上传到

redhat

0818b9ca8b590ca3270a3433284dd417.png

2  我的电脑是Redhat 6.*版本,所以这里使用上面一个

3解压zip包

0818b9ca8b590ca3270a3433284dd417.png

4  安装以下几个

rpm

MySQL-client-advanced-5.6.20-1.el6.x86_64.rpm

MySQL-server-advanced-5.6.20-1.el6.x86_64.rpm

0818b9ca8b590ca3270a3433284dd417.png

5查看已经安装过的mysql

rpm –aq | grep mysql

结果:

mysql-libs-5.1.66-2.el6_3.x86_64

mod_auth_mysql-3.0.0-11.el6_0.1.x86_64

mysql-connector-java-5.1.17-6.el6.noarch

mysql-test-5.1.66-2.el6_3.x86_64

mysql-devel-5.1.66-2.el6_3.x86_64

libdbi-dbd-mysql-0.8.3-5.1.el6.x86_64

qt-mysql-4.6.2-25.el6.x86_64(这个不用卸载)

rsyslog-mysql-5.8.10-6.el6.x86_64

mysql-bench-5.1.66-2.el6_3.x86_64

mysql-connector-odbc-5.1.5r1144-7.el6.x86_64

dovecot-mysql-2.0.9-5.el6.x86_64

php-mysql-5.3.3-22.el6.x86_64

mysql-5.1.66-2.el6_3.x86_64

mysql-server-5.1.66-2.el6_3.x86_64

说明上面这些Mysql相关的已经安装了。

6卸载上面安装过的mysql

使用rpm –e mysql –nodeps –allmatches(不理会依赖关系,删除所有上一步查出来的相同的mysql)命令卸载上面不需要的mysql

例如:

rpm -e mysql-libs-5.1.66-2.el6_3.x86_64--nodeps –allmatches

0818b9ca8b590ca3270a3433284dd417.png

按照相同的命令对安装的其它mysql进行删除。

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

7将老版本的几个文件手工删除

[root@localhost mysql]# rm -f /etc/my.cnf

[root@localhost mysql]# rm -rf/var/lib/mysql

[root@localhost mysql]# rm -rf/var/share/mysql

[root@localhost mysql]# rm -rf/usr/bin/mysql*

[root@localhost mysql]#

8安装mysql服务器端

[root@localhost mysql]# rpm -ivhMySQL-server-advanced-5.6.20-1.el6.x86_64.rpm

Preparing...###########################################[100%]

1:MySQL-server-advanced########################################### [100%]

2014-10-12 15:22:30 0 [Warning] TIMESTAMPwith implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).

2014-10-12 15:22:30 6074 [Note] InnoDB:Using atomics to ref count buffer pool pages

2014-10-12 15:22:30 6074 [Note] InnoDB:Database physically writes the file full: wait...

2014-10-12 15:22:31 6074 [Note] InnoDB:Setting log file ./ib_logfile101 size to 48 MB

关于说明信息:

A RANDOM PASSWORD HAS BEEN SET FOR THEMySQL root USER !

You will find thatpassword in '/root/.mysql_secret'.

You mustchangethat password on your first connect,

no other statement but 'SET PASSWORD' willbe accepted.

See the manual for thesemantics of the 'password expired' flag.

Also, the account for theanonymous user has been removed.

In addition, you can run:

/usr/bin/mysql_secure_installation

which will also give you the option ofremoving the test database.

This is strongly recommended for productionservers.

See the manual for more instructions.

Please report any problems athttp://bugs.mysql.com/

The latest information about MySQL isavailable on the web at

http://www.mysql.com

Support MySQL by buying support/licenses athttp://shop.mysql.com

New default config file was created as/usr/my.cnf and

will be used by default by the server whenyou start it.

You may edit this file to change serversettings

9安装mysql的客户端

[root@localhost mysql]# rpm -ivhMySQL-client-advanced-5.6.20-1.el6.x86_64.rpm

Preparing...########################################### [100%]

1:MySQL-client-advanced########################################### [100%]

10安装MySQL-devel-advanced-5.6.20-1.el6.x86_64.rpm

[root@localhost mysql]# rpm -ivhMySQL-devel-advanced-5.6.20-1.el6.x86_64.rpm

Preparing...########################################### [100%]

1:MySQL-devel-advanced########################################### [100%]

[root@localhost mysql]#

11修改mysql的密码,第一次安装的时候在,第一次安装的时候的密码文件在/root/.mysql_secret中

修改密码:

0818b9ca8b590ca3270a3433284dd417.png

[root@localhost ~]# pwd

/root

12查看密码:cat.mysql_secret

oracle收购Mysql后,新版的mysql刚安装完mysql后不能直接输入mysql登录数据库,而是设置了默认free password密码,默认密码放在了/root/.mysql_secret文件中,登陆后需要修改密码.

0818b9ca8b590ca3270a3433284dd417.png

13修改密码

A启动mysql

service mysql start

0818b9ca8b590ca3270a3433284dd417.png

B如果想关闭服务,命令是servicemysql stop

14登录服务器

mysql -u root -p

为用户设置新密码

set password=password('123456');

0818b9ca8b590ca3270a3433284dd417.png

也可以使用脚本/usr/bin/mysql_secure_installation进行交互式的修改mysql的root密码

0818b9ca8b590ca3270a3433284dd417.png

15.重新启动一下redhat操作系统,然后再登陆(修改后再登陆发现登陆不了)

0818b9ca8b590ca3270a3433284dd417.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值