zoukankan      html  css  js  c++  java
  • centos6.5设备mysql5.6

    1. 首先检查版本号number

    # uname -a
    

    要么

    # cat /etc/redhat-release 
    CentOS release 6.6 (Final)
    

    2. 下载并安装Mysql的yum仓库

    下载Mysql的yum仓库

    http://dev.mysql.com/downloads/repo/yum/

    然后安装一下这个仓库列表

    $ sudo yum localinstall mysql-community-release-el6-5.noarch.rpm 
    

    3. 搜索可安装的mysql版本号

    运行这个命令后就能看到可安装的mysql:

    # yum repolist enabled | grep "mysql.*-community.*"
    

    假设我们是要安装最新的版本号,那么能够直接运行

    # sudo yum install mysql-community-server
    

    假设我们要选择版本号,能够先运行以下这个命令查看一下有哪些版本号:

    # yum repolist all | grep mysql
    

    假设要选择版本号的话,有两种方式,一种是使用命令来

    $ sudo yum-config-manager --disable mysql56-community
    $ sudo yum-config-manager --enable mysql57-community-dmr
    

    这个命令就是在仓库中启用5.7版本号的。禁用5.6版本号子仓库
    或者编辑/etc/yum.repos.d/mysql-community.repo文件

    # Enable to use MySQL 5.6
    [mysql56-community]
    name=MySQL 5.6 Community Server
    baseurl=//repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/
    enabled=1
    gpgcheck=1
    gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 
    

    enabled=0表示禁用
    比方要安装5.7版本号的mysql,要确定5.6的enabled=0,5.7的enabled=1。一次保证仅仅启用一个子仓库

    # Note: MySQL 5.7 is currently in development. For use at your own risk.
    # Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
    [mysql57-community-dmr]
    name=MySQL 5.7 Community Server Development Milestone Release
    baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
    enabled=1
    gpgcheck=1
    gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    

    然后我们又能够愉快的安装mysql了

    $ sudo yum install mysql-community-server
    

    安装完毕后我们启动mysql

    $ sudo service mysqld start
    

    查看mysql状态

    $ sudo service mysqld status
    

    启动mysql服务并初始化:

    # /etc/init.d/mysqld start
    Initializing MySQL database: 
    PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:
    
    /usr/bin/mysqladmin -u root password 'new-password'
    /usr/bin/mysqladmin -u root -h iZ94vana2fdZ password 'new-password'
    
    Alternatively you can run:
    /usr/bin/mysql_secure_installation
    
    which will also give you the option of removing the test
    databases and anonymous user created by default. This is
    strongly recommended for production servers.
    
    See the manual for more instructions.
    
    Please report any problems at http://bugs.mysql.com/
    
    [ OK ]
    Starting mysqld: [ OK ]
    

    4. 相关命令

    启动mysql服务

    # service mysqld start
    

    重新启动mysql服务

    # service mysqld restart
    

    停止mysql服务

    # service mysqld stop
    

    版权声明:本文博主原创文章,博客,未经同意不得转载。

  • 相关阅读:
    【BZOJ1294】围豆豆(SCOI2009)-状压+BFS
    【BZOJ3244】树的计数(NOI2013)-概率期望+数学证明
    【BZOJ4826】影魔(AHOI&HNOI2017)-线段树+离线
    【BZOJ3832】Rally(POI2014)-拓扑排序+最长路+堆
    【BZOJ4556】字符串(TJOI&HEOI2016)-后缀数组+二分+RMQ+主席树
    【BZOJ1029】建筑抢修(JSOI2007)-贪心+堆
    【BZOJ1057】棋盘制作(ZJOI2007)-DP+悬线法
    【BZOJ1025】游戏(SCOI2009)-数论+背包DP
    java日期操作
    list类型for遍历
  • 原文地址:https://www.cnblogs.com/hrhguanli/p/4807712.html
Copyright © 2011-2022 走看看