码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2014-10-12 20:53:18      阅读:320      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   使用   ar   java   


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

bubuko.com,布布扣

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

解压zip

bubuko.com,布布扣

4  安装以下几个rpm

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

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

bubuko.com,布布扣

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

bubuko.com,布布扣

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

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

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 must changethat 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

修改密码:

bubuko.com,布布扣

[root@localhost ~]# pwd

/root

 

12 查看密码:cat.mysql_secret

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

bubuko.com,布布扣

 

13  修改密码

A 启动mysql

service mysql start

bubuko.com,布布扣

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

 

14 登录服务器

mysql -u root -p

为用户设置新密码

set password=password(‘123456‘);

bubuko.com,布布扣

 

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

 

bubuko.com,布布扣

 

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

bubuko.com,布布扣

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

标签:style   blog   http   color   io   os   使用   ar   java   

原文地址:http://blog.csdn.net/tototuzuoquan/article/details/40019899

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!