CentOS 6オフラインrpmでmysql 5をインストールする.7

3997 ワード

宣言
本文は自分の完全なインストールの過程を記録して、その中で公式サイトとインターネットのいくつかの文章を参考にしました.
ソフトウェアリスト
  • CentOS 6 -64
  • MySQL5.7.20

  • MySQLダウンロード
    公式サイトでMysqlをダウンロードする方法を知らない人がたくさんいます.まずMySQL Community Serverをダウンロードします.システムによって適切なものを選択すればいいです.私たちのCentOS 6には見つかりません.それ自体がRedHatに属しているので、対応を見つけることができます.私のここは64ビットのサーバーなので、私は直接ダウンロードの接続を提供して、あなたの机械のバージョンを选びました.私はブラウザのダウンロード会のカードの主な现象に出会って、私はある雷でダウンロードすることをお勧めします.
    インストール
    まずシステムはMysqlをきれいにアンインストールして、具体的な手順は、ここでは説明しません.インストールだけです.ダウンロードされたパケットmysql-5.7.20-1.el6.x86_64.rpm-bundle.tarは、/rootのようなサーバにアップロードされ、ディレクトリにアップロードされる.
  • 解凍
  • $ tar -xvf mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar
    
  • 取付手順 , --nosignature
  • $ rpm -ivh mysql-community-common-5.7.20-1.el6.x86_64.rpm --nosignature
    $ rpm -ivh mysql-community-libs-5.7.20-1.el6.x86_64.rpm --nosignature
    $ rpm -ivh mysql-community-devel-5.7.20-1.el6.x86_64.rpm --nosignature
    $ rpm -ivh mysql-community-client-5.7.20-1.el6.x86_64.rpm --nosignature
    $ rpm -ivh mysql-community-server-5.7.20-1.el6.x86_64.rpm --nosignature
    
  • 取付パッケージ作用
  • mysql-devel             
    mysql mysql    
    mysql-server       
    
  • インストールパッケージ *.rpm
  • を削除する.
    $ sudo rm -rf mysql*.rpm
    

    �* が取り付けられているかどうかを確認する
    $ rpm -qa| grep mysql
    mysql-community-devel-5.7.20-1.el6.x86_64
    mysql-community-common-5.7.20-1.el6.x86_64
    mysql-community-server-5.7.20-1.el6.x86_64
    mysql-community-client-5.7.20-1.el6.x86_64
    mysql-community-libs-5.7.20-1.el6.x86_64
    
  • 再検査
  • $ rpm -q mysql-community-server-5.7.20-1.el6.x86_64
    mysql-community-server-5.7.20-1.el6.x86_64
    

    rootユーザーなら
    $ vim /etc/my.cnf 
        
    [mysqld]
    user=mysql
    
  • 起動
  • $ cd /etc/init.d
    $ service mysqld start
    

    このエラーが表示されるかもしれません[ERROR] --initialize specified but the data directory has files in it. Aborting.
    $ cd /var/lib
    $ mv mysql mysql.bak
    $ cd /etc/init.d
    $ service mysqld start
    Initializing MySQL database:                               [  OK  ]
    Starting mysqld:                                           [  OK  ]
    
  • 検証サービス実行方式一
  • $service mysqld status
    mysqld (pid  xxxxx) is running...mysqld (pid  xxxxx) is running...
    
  • 検証サービス運行方式二
  • ps -ef | grep -i mysql
    root     27698     1  0 14:55 ?        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    27906 27698  0 14:55 ?        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     29144 28578  0 15:05 pts/3    00:00:00 grep -i mysql
    

    ここまでMySQLがインストールを完了し、サーバーが起動しました.*rootパスワードを設定する資料は/root/.mysql_secretにはrootパスワードが保存されていますが、ここでは見つかりません.権限検証を迂回して具体的な手順を変更します.
    $ service mysqld stop
    $ vim /etc/
    $ mysqld_safe --skip-grant-tables
       Shell   ,      ,     
       Shell   
    $mysql
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 4
    Server version: 5.7.20 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2017, 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> use mysql
    mysql>update mysql.user set authentication_string=password('root') where user='root' ;
    

    mysqldを再起動し、ログインします
    $service mysqld restart
    $mysql -uroot -proot
    

    全文が終わる