mysql5.1 升级5.6版本

一、安装yum源自带MYSQL5.1

1.查看yum源上的mysql版本

命令:#yum list mysql-*

已安装的软件包

mysql.x86_64                5.1.73-3.el6_5     @anaconda-CentOS-201410241409.x86_64/6.6

mysql-devel.x86_64          5.1.73-3.el6_5     @anaconda-CentOS-201410241409.x86_64/6.6

mysql-libs.x86_64           5.1.73-3.el6_5     @anaconda-CentOS-201410241409.x86_64/6.6

可安装的软件包

MySQL-python.x86_64         1.2.3-0.3.c1.1.el6 base                            

mysql-bench.x86_64          5.1.73-3.el6_5     base                            

mysql-connector-java.noarch1:5.1.17-6.el6     base                            

mysql-connector-odbc.x86_645.1.5r1144-7.el6   base                            

mysql-devel.i686            5.1.73-3.el6_5     base                            

mysql-embedded.i686         5.1.73-3.el6_5     base                             

mysql-embedded.x86_64       5.1.73-3.el6_5     base                            

mysql-embedded-devel.i686   5.1.73-3.el6_5     base                            

mysql-embedded-devel.x86_645.1.73-3.el6_5     base                             

mysql-libs.i686             5.1.73-3.el6_5     base                            

mysql-server.x86_64         5.1.73-3.el6_5     base                            

mysql-test.x86_64           5.1.73-3.el6_5     base

从上面可得知自带的yum源里所使用的是mysql5.1.73的版本

2.安装mysql以及所有组建

命令:# yum install -y mysql-*

......................中间省略知自动安装过程

3.查看是否安装成功

# rpm -q mysql-*

mysql-5.1.73-3.el6_5.x86_64

4.启动mysql数据库服务,并设置root

# service mysqld start

.......中间省略数行启动字符

正在启动 mysqld                                          [确定]

# mysqladmin -uroot password123456

5.进入mysql数据库并新建数据库并录入数据

# mysql -p

Enter password:

mysql>

(1)显示当前数据库

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

+--------------------+

3 rows in set (0.00 sec)

(2)创建一个名为ceshi的数据库

mysql> create database ceshi;

Query OK, 1 row affected (0.00 sec)

(3)创建表并录入一条信息

mysql> use ceshi;

Database changed

mysql> create table cstable (name varchar(20),sex char(1),birth date);

Query OK, 0 rows affected (0.16 sec)

 

mysql> show tables;

+-----------------+

| Tables_in_ceshi |

+-----------------+

| cstable         |

+-----------------+

1 row in set (0.00 sec)

6.退出mysql数据库

mysql> \q

到此全部前期工作已准备完毕,开始升级mysql5.6

一、升级前先备份出之前我们新建的数据库,使用到的命令

[root@yueyue ~]#mysqldump -uroot -p ceshi > /shengji/ceshi.sql

Enter password:

[root@yueyue ~]# ls/shengji/

ceshi.sql

[root@yueyue ~]#

二、按照以上方法备份好数据库以后,将原有mysql5.1数据库版本卸载

# yum remove -y mysql-*

........省略卸载过程

# rm -rf /var/lib/mysql #####必须删除不然重装没发启动数据库

三、去mysql官方网站下载mysql5.6 64位的rpm

 

下载地址:

# ls /shengji

mysql-community-release-el6-5.noarch.rpm  

为了解决本地源的应用程序间相互依赖关系,须执行一下命令

# cd /shengji

# yum localinstall-y mysql-community-release-el6-5.noarch.rpm

...............中间省略安装过程多个字符

可以通过下面的命令来确认这个yum源被成功添加,可执行以下命令:

# yum repolistenabled | grep "mysql.*-community.*"

mysql-connectors-community           MySQL Connectors Community               14

mysql-tools-community                MySQL Tools Community                    23

mysql56-community                    MySQL 5.6 CommunityServer              146

[root@yueyue shengji]# yum -y install mysql-community-server


[root@yueyue shengji]# mysql -V

mysql  Ver 14.14 Distrib 5.6.24, for Linux (x86_64) using  EditLine wrapper

[root@yueyue ~]# service mysqld start

正在启动 mysqld:                                          [确定]

[root@yueyue ~]#

[root@yueyue ~]# ps -ef |grep mysql

root      17338      1  0 14:14 pts/2    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql

mysql     17542  17338  2 14:14 pts/2    00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock

root      17604  14460  0 14:15 pts/2    00:00:00 grep mysql


 

[root@yueyue ~]# mysqladmin -u root password “123456”


Warning: Using a password on the command line interface can be insecure.

[root@yueyue ~]# mysql -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 11

Server version: 5.6.24 MySQL Community Server (GPL)


Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> 

 


你可能感兴趣的:(mysql,升级,软件包)