rhel、centos、fedora使用yum安装mysql community server

  1. 在mysql官方链接中下载redhat系列的相应版本的升级包:

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


  2. redhat中root用户执行:rpm -Uvh mysql-community-release-el****.noarch.rpm


  3. 查看支持升级安装的mysql版本:

    [root@cd ~]# yum repolist all | grep mysql

    mysql-connectors-community        MySQL Connectors Community      enabled:     5

    mysql-connectors-community-source MySQL Connectors Community - So disabled

    mysql56-community                 MySQL 5.6 Community Server      enabled:    94

    mysql56-community-source          MySQL 5.6 Community Server - So disabled

    mysql57-community-dmr             MySQL 5.7 Community Server Deve disabled

    mysql57-community-dmr-source      MySQL 5.7 Community Server Deve disabled


  4. [root@cd ~]# yum install mysql-community-server

    ......

    Dependencies Resolved

    ==================================================================================

     Package                       Arch   Version           Repository           Size

    ==================================================================================

    Installing:

    mysql-community-server        i386   5.6.24-3.el5      mysql56-community    83 M

    Installing for dependencies:

    mysql                         i386   5.6.24-3.el5      mysql56-community    38 k

    mysql-community-client        i386   5.6.24-3.el5      mysql56-community    22 M

    mysql-community-common        i386   5.6.24-3.el5      mysql56-community   692 k

    mysql-community-libs          i386   5.6.24-3.el5      mysql56-community   2.3 M

    mysql-community-libs-compat   i386   5.6.24-3.el5      mysql56-community   2.0 M

    perl-DBI                      i386   1.52-2.el5        base                600 k


    Transaction Summary

    ==================================================================================

    Install       7 Package(s)

    Upgrade       0 Package(s)


    Total download size: 111 M

    Is this ok [y/N]: y

    Downloading Packages:

    (1/7): mysql-5.6.24-3.el5.i386.rpm                         |  38 kB     00:02     

    (2/7): perl-DBI-1.52-2.el5.i386.rpm                        | 600 kB     00:11     

    (3/7): mysql-community-common-5.6.24-3.el5.i386.rpm        | 692 kB     00:17     

    (4/7): mysql-community-libs-compat-5.6.24-3.el5.i386.rpm   | 2.0 MB     00:51     

    (5/7): mysql-community-libs-5.6.24-3.el5.i386.rpm          | 2.3 MB     01:12     

    (6/7): mysql-community-client-5.6.24-3.el5.i386.rpm        |  22 MB     06:58     

    (7/7): mysql-community-server-5.6.24-3.el5.i386.rpm        |  83 MB     13:29     

    ----------------------------------------------------------------------------------

    Total                                              82 kB/s | 111 MB     23:07     

    warning: rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID 5072e1f5

    mysql56-community/gpgkey                                   | 2.1 kB     00:00     

    Importing GPG key 0x5072E1F5 "MySQL Release Engineering <[email protected]>" from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

    Is this ok [y/N]: y

    warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897

    base/gpgkey                                                | 1.5 kB     00:00     

    Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) <[email protected]>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

    Is this ok [y/N]: y

    Running rpm_check_debug

    Running Transaction Test

    Finished Transaction Test

    Transaction Test Succeeded

    Running Transaction

      Installing     : perl-DBI                                                   1/7 

      Installing     : mysql-community-libs                                       2/7 

      Installing     : mysql-community-common                                     3/7 

      Installing     : mysql-community-client                                     4/7 

      Installing     : mysql-community-libs-compat                                5/7 

      Installing     : mysql-community-server                                     6/7 

    warning: user mysql does not exist - using root

    warning: user mysql does not exist - using root

      Installing     : mysql                                                      7/7 


    Installed:

      mysql-community-server.i386 0:5.6.24-3.el5

    Dependency Installed:

      mysql.i386 0:5.6.24-3.el5                                                       

      mysql-community-client.i386 0:5.6.24-3.el5                                      

      mysql-community-common.i386 0:5.6.24-3.el5                                      

      mysql-community-libs.i386 0:5.6.24-3.el5                                        

      mysql-community-libs-compat.i386 0:5.6.24-3.el5                                 

      perl-DBI.i386 0:1.52-2.el5                                                      


    Complete!


  5. 添加mysql用户:

    useradd -g mysql mysql


  6. 关键目录改变属主权限

    chown -R mysql:mysql /var/run/mysqld

    chown -R mysql:mysql /var/lib/mysql


  7. 创建基础user表

    mysql_install_db --user=mysql --ldata=/var/lib/mysql


  8. 启动、停止mysql server:

    service mysqld start/status/stop

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。