CentOS7.4 MySQL5.7.28バイナリモードでのインストールの下で

Linuxシステムのバージョン:CentOS7.4
MySQLのバージョン:5.7.28は、
Linuxのプラットフォーム上でどのようにMySQLを導入する例として、LinuxプラットフォームでバイナリパッケージをRPMパッケージを持って、3つの方法でインストールされたソースパッケージは、この記事では、主にRPMパッケージに基づいていますインストール。
ダウンロード:
https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz

CentOS7.4 MySQL5.7.28バイナリモードでのインストールの下で
:次のように具体的な手順は、
(1)最初にアンインストールmariadbを、または他の背後にあるとMySQLデータベースの競合をインストールする必要があります。

[root@localhost ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

(2)ユーザ・データベースにインストールされたルート・システム、ユーザー及びグループのMySQLの増加とともにユーザ:

[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -r -g mysql -s /bin/false mysql

(3)データディレクトリを準備
/アプリ/データに、例えば、我々は論理的使用をお勧めし
ます。[root @ localhostの〜]#ます。mkdir -p /アプリ/データ
/ [ルート@ localhostの〜]#chownコマンドmysql.mysql /アプリ/データ
[ルートを〜@localhost]#chmodの750 /アプリ/データ
バイナリを準備する(4):

[root@localhost ~]# tar xvf mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
root@localhost ~]# cd /usr/local
[root@localhost local]# ln -sv mysql-5.7.28-linux-glibc2.12-x86_64 mysql
‘mysql’ -> ‘mysql-5.7.28-linux-glibc2.12-x86_64’

(5)初期のMySQL:

[root@localhost ~]# cd /usr/local/mysql
[root@localhost mysql]# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/app/data
2019-11-03T09:47:18.263716Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-11-03T09:47:19.059462Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-11-03T09:47:19.140866Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-11-03T09:47:19.207569Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: ed1cd8ec-fe1e-11e9-8c9c-000c29f8617a.
2019-11-03T09:47:19.209181Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-11-03T09:47:19.646366Z 0 [Warning] CA certificate ca.pem is self signed.
2019-11-03T09:47:20.056792Z 1 [Note] A temporary password is generated for root@localhost: rY-6f??#!<zO

どちらのは、MySQLベースディレクトリ--datadir mysqlのデータ格納ディレクトリを--basedir、rootユーザーのための一時的なパスワードを作成:! RY-6F ??#<ZO
(6)オープンSSL接続:

[root@localhost mysql]# bin/mysql_ssl_rsa_setup
2019-11-03 23:09:55 [ERROR]   Failed to access directory pointed by --datadir. Please make sure that directory exists and is accessible by mysql_ssl_rsa_setup. Supplied value : /usr/local/mysql/data
[root@localhost mysql]# bin/mysql_ssl_rsa_setup --datadir=/app/data

パラメータエラーなしでコマンドの後に、エラープラス--datadirなし後
(7)、設定ファイルを編集して保存し、終了します。

[root@localhost mysql]# vim /etc/my.cnf
[mysqld]
# GENERAL
datadir=/app/data
socket=/app/data/mysql.sock
user=mysql
default-storage-engine=InnoDB

[mysqld_safe]
log-error=/app/data/mysql-error.log
pid-file=/app/data/mysqld.pid

[client]
socket=/app/data/mysql.sock

(8)MySQLを起動します。

[root@localhost mysql]# bin/mysqld_safe --user=mysql &

(9)環境変数を設定する:
[ルート@ localhostの〜]#のVimは/ etc / profileの
#は、次の行を追加します。
エクスポートPATH = $ PATH:は/ usr / local / MySQLは/ binに
[ルート@ localhostの〜]#のソースは/ etc / profileを

(10)は、ブートを設定します。

[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysql.server
[root@localhost mysql]# chkconfig --add mysql.server

(11)テスト成功したログイン:


[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.28

Copyright (c) 2000, 2019, 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>

おすすめ

転載: blog.51cto.com/13486869/2447451