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



1 将相关的mysql rpm包上传到redhat上

4e0b5c5222eb6d9dead897e2a2af7c8e.png

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

3解压zip包

fd499237661fc9f38d3f136cf640cc87.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

10d1fe772232d39909619988a078c9a5.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

04758f2d6b7a96be5c86edf76926cbda.png

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

a9b220ce7d6b2eef82f4f416fc8050df.png

e6cfc203f1d4d218819bea9c3ff5455c.png

87b2b1dfe56b8fe9bb4ac87fc252446a.png

0252fc6ec9d936854f7fe077658cdbed.png

cebc8c54abf05a2844517c5ae5f576e5.png

efffe74e2a84d88fb4da799af21b193a.png

1f25d644ed0b4bf445c4ab1534fbcba3.png

968b608aa03a16e62a058b28c46ab0a0.png

3e3dacdad43b3d1abe17d9ba66c767bf.png

3d06b048fd414939cbbb525ddecb774f.png

e87f44f0a0ef0e98e06f473023d5f431.png

04743948a0cf964791fbddf14a624443.png

1906699bdede0e9df840a6d2b9f2dadc.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中

修改密码:

9e479d183359622361367cc23820b61d.png

[root@localhost ~]# pwd

/root

12查看密码:cat.mysql_secret

oracle收购Mysql后,新版的mysql刚安装完mysql后不能直接输入mysql登录数据库,而是设置了默认free

password密码,默认密码放在了/root/.mysql_secret文件中,登陆后需要修改密码.

589c10dbe7c92f4c046ca799f4f1d77d.png

13修改密码

A启动mysql

service mysql start

b1a40ff047d3fcc9f2afc9d8c612ec24.png

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

14登录服务器

mysql -u root -p

为用户设置新密码

set password=password('123456');

6d8b4245ff98194aa676dff6b4f4f9bc.png

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

a889ff224017e3b01c19bf95b87736ee.png

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

6ad38749c600a69757f213dd49376ddc.png

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值