1.查看操作系统的相关信息

2.查看系统上所有MySQL的rpm包并删除

  [root@master ~]# rpm -qa | grep -i mysql

  [root@masterc ~]# yum -y remove mysql-libs-5.1*

3.下载MySQL-5.6.21所需的rpm包

  [root@master tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm 
  [root@master tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm 
  [root@master tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm

4.安装三个rpm包

  [root@master tools]# rpm -ivh MySQL-server-5.6.21-1.rhel5.x86_64.rpm

  如果运行的过程是这样,就恭喜你失败了,因为之前安装的MySQL没有删除干净,会导致后面出现各种乱七八糟的错。

  Preparing...                    ########################################### [100%] 
      1:MySQL-client          ########################################### [100%]

  解决方法:查看残留的目录并删除相关的文件

    whereis mysql

    rm –rf /usr/lib64/mysql

    rm –rf /usr/my.cnf
    rm -rf /root/.mysql_sercret

    rm -rf /var/lib/mysql

  正确的过程:

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

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

2017-09-25 13:46:09 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2017-09-25 13:46:09 2188 [Note] InnoDB: Using atomics to ref count buffer pool pages

2017-09-25 13:46:09 2188 [Note] InnoDB: The InnoDB memory heap is disabled

2017-09-25 13:46:09 2188 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2017-09-25 13:46:09 2188 [Note] InnoDB: Memory barrier is not used

2017-09-25 13:46:09 2188 [Note] InnoDB: Compressed tables use zlib 1.2.3

2017-09-25 13:46:09 2188 [Note] InnoDB: Using Linux native AIO

2017-09-25 13:46:09 2188 [Note] InnoDB: Using CPU crc32 instructions

2017-09-25 13:46:09 2188 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2017-09-25 13:46:09 2188 [Note] InnoDB: Completed initialization of buffer pool

2017-09-25 13:46:09 2188 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!

2017-09-25 13:46:09 2188 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

2017-09-25 13:46:09 2188 [Note] InnoDB: Database physically writes the file full: wait...

2017-09-25 13:46:09 2188 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2017-09-25 13:46:09 2188 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2017-09-25 13:46:10 2188 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2017-09-25 13:46:10 2188 [Warning] InnoDB: New log files created, LSN=45781

2017-09-25 13:46:10 2188 [Note] InnoDB: Doublewrite buffer not found: creating new

2017-09-25 13:46:10 2188 [Note] InnoDB: Doublewrite buffer created

2017-09-25 13:46:10 2188 [Note] InnoDB: 128 rollback segment(s) are active.

2017-09-25 13:46:10 2188 [Warning] InnoDB: Creating foreign key constraint system tables.

2017-09-25 13:46:10 2188 [Note] InnoDB: Foreign key constraint system tables created

2017-09-25 13:46:10 2188 [Note] InnoDB: Creating tablespace and datafile system tables.

2017-09-25 13:46:10 2188 [Note] InnoDB: Tablespace and datafile system tables created.

2017-09-25 13:46:10 2188 [Note] InnoDB: Waiting for purge to start

2017-09-25 13:46:10 2188 [Note] InnoDB: 5.6.21 started; log sequence number 0

A random root password has been set. You will find it in '/root/.mysql_secret'.

2017-09-25 13:46:14 2188 [Note] Binlog end

2017-09-25 13:46:14 2188 [Note] InnoDB: FTS optimize thread exiting.

2017-09-25 13:46:14 2188 [Note] InnoDB: Starting shutdown...

2017-09-25 13:46:15 2188 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2017-09-25 13:46:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2017-09-25 13:46:15 2211 [Note] InnoDB: Using atomics to ref count buffer pool pages

2017-09-25 13:46:15 2211 [Note] InnoDB: The InnoDB memory heap is disabled

2017-09-25 13:46:15 2211 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2017-09-25 13:46:15 2211 [Note] InnoDB: Memory barrier is not used

2017-09-25 13:46:15 2211 [Note] InnoDB: Compressed tables use zlib 1.2.3

2017-09-25 13:46:15 2211 [Note] InnoDB: Using Linux native AIO

2017-09-25 13:46:15 2211 [Note] InnoDB: Using CPU crc32 instructions

2017-09-25 13:46:15 2211 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2017-09-25 13:46:15 2211 [Note] InnoDB: Completed initialization of buffer pool

2017-09-25 13:46:15 2211 [Note] InnoDB: Highest supported file format is Barracuda.

2017-09-25 13:46:15 2211 [Note] InnoDB: 128 rollback segment(s) are active.

2017-09-25 13:46:15 2211 [Note] InnoDB: Waiting for purge to start

2017-09-25 13:46:15 2211 [Note] InnoDB: 5.6.21 started; log sequence number 1625977

2017-09-25 13:46:15 2211 [Note] Binlog end

2017-09-25 13:46:15 2211 [Note] InnoDB: FTS optimize thread exiting.

2017-09-25 13:46:15 2211 [Note] InnoDB: Starting shutdown...

2017-09-25 13:46:17 2211 [Note] InnoDB: Shutdown completed; log sequence number 1625987

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,

no other statement but 'SET PASSWORD' will be accepted.

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

Also, the account for the anonymous user has been removed.

In addition, you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.

This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

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

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

will be used by default by the server when you start it.

You may edit this file to change server settings

WARNING: Default config file /etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

--defaults-file argument to mysqld_safe when starting the server

[root@master tools]# rpm -ivh MySQL-client-5.6.21-1.rhel5.x86_64.rpm

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

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

[root@master tools]# rpm -ivh MySQL-devel-5.6.21-1.rhel5.x86_64.rpm

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

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

5.修改配置文件位置

  [root@master tools]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

  [root@master tools]#cp -a /usr/share/mysql/mysql.server /etc/init.d/mysqld

6.初始化MySQL

  [root@master tools]# /usr/bin/mysql_install_db

7.启动MySQL

  [root@master mysql]# /etc/init.d/mysql restart

安装的时候参考了http://www.linuxidc.com/Linux/2015-04/116003.htm

最新文章

  1. 学习 shell脚本之前的基础知识
  2. [转]DCM Tutorial – An Introduction to Orientation Kinematics
  3. CUDA学习笔记(四)——CUDA性能
  4. 《OD大数据实战》MongoDB环境搭建
  5. 免费的手机号码归属地查询API接口文档
  6. ipad安装自制ipa
  7. 在PreparedStatement中设置空值
  8. Kafka主要参数详解
  9. 星级评分条(RatingBar)的功能和用法
  10. centos永久修改主机名
  11. js中把ajax获取的数据转化成树状结构(并做成多级联动效果)
  12. Python多线程下存在_strptime的问题
  13. PHP----------线程安全和非线程安全的介绍
  14. 每天一个linux命令(8):rm
  15. winform rar压缩包解压缩
  16. 不常用的vi命令
  17. C#设计模式——简单工厂模式、工厂模式和抽象工厂模式
  18. [PHP]json_encode增加options参数后支持中文
  19. STL基础1:vector
  20. JavaScript--动态加载脚本和样式(23)

热门文章

  1. FJUT3701 这也是一道数论题(线段树)题解
  2. [js] - 前端FileReader使用,适用于文件上传预览.(并未传入后端)
  3. 【Ruby】【环境搭建】macOS Sierra 10.12.6 + Xcode 8 + gpg 2.2.8 + rvm 1.29.3 + Ruby 2.4.0 + RubyMine 2018.1.4
  4. python多进程apply与apply_async的区别
  5. JQuery学习二-字典操作
  6. [Java] 项目红色叹号 案例1则
  7. 『TensorFlow』读书笔记_进阶卷积神经网络_分类cifar10_下
  8. python自动化测试入门篇-jemter连接mysql数据库
  9. CSS样式表与HTML结合的方法
  10. Vue(六) 表单与 v-model