Centos7は、MySQL 5.7.26のバイナリバージョンを展開します

MySQL5.7部署可以分为rpm包部署、源码包部署、二进制包部署。

ソースパッケージの展開:高い柔軟性の利点、あなたは、高効率をビルドパラメータをカスタマイズすることができ、欠点が展開するのに長い時間である
バイナリパッケージの展開を:利点は速いの展開の前にコンパイルされ、あなたはいくつかのパラメータをカスタマイズすることができ、欠点は時間でありますyumをインストールまたは長いと比較して
rpmパッケージの配備:速い展開速度の利点、欠点が悪い習慣である
、一般的に特別な要件は、yumのパッケージを展開するために使用することはできません
開始し、以下のバイナリパッケージの展開MySQL5.7.26は、バイナリの
ダウンロード:HTTPS: //dev.mysql.com/downloads/mysql/5.7.html#downloadsは、
ジェネリック(2.12 glibcを)( -のLinuxの下で、オペレーティングシステムの選択オプションで「Linuxの総称を」選択のx86 64ビット)、TARのアイテムダウンロードするには、ダウンロードの後ろ
1.ユーザーとユーザーグループを実行しているMySQLデータベースを追加します。

groupadd -r mysql
useradd -r -g mysql mysql

2. MySQLのディレクトリの展開は、/アプリケーション、/application/mysql-5.7.26-linux-glibc2.12-x86_64ディレクトリを抽出するためのMySQLのインストールパッケージ、およびソフトリンクを作成するには、このディレクトリです

 ln -s /application/mysql-5.7.26-linux-glibc2.12-x86_64 /application/mysql

変更ディレクトリのパーミッション
chown -R mysql:mysql /application/mysql-5.7.26-linux-glibc2.12-x86_64
3.データベースを初期化します

/application/mysql-5.7.26-linux-glibc2.12-x86_64/bin/mysqld --initialize --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data

[root@chanye application]# /application/mysql-5.7.26-linux-glibc2.12-x86_64/bin/mysqld --initialize --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
2019-06-18T08:35:49.103727Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-06-18T08:35:49.885283Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-06-18T08:35:49.944856Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-06-18T08:35:50.002905Z 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: 138aa81a-91a4-11e9-8f49-005056813525.
2019-06-18T08:35:50.004044Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-06-18T08:35:50.004493Z 1 [Note] A temporary password is generated for root@localhost: O;iSA6z>SieK

仮パスワードの最後の行に注意してください
。4. RSA秘密鍵を作成します。

/application/mysql/bin/mysql_ssl_rsa_setup --datadir=/application/mysql/data
Generating a 2048 bit RSA private key
..........................................................................................+++
....+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
............................+++
.+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
..........................................................................+++
...........................................................................................+++
writing new private key to 'client-key.pem'

5.スタートから起動するようにMySQLを追加

cp /application/mysql-5.7.26-linux-glibc2.12-x86_64/support-files/mysql.server /etc/init.d/mysqld

BASEDIRとDATADIRを/etc/init.d/mysqld変更

46 basedir=/application/mysql
 47 datadir=/application/mysql/data

スタートからの起動に参加

chkconfig mysqld on
chkconfig --list mysqld
Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

グローバルコンフィギュレーションファイルmysqlの実行可能ファイルのパスをPATHに追加されます修正し、/ etcにある/最後の行を追加しますプロフィール:

export PATH=/application/mysql/bin:$PATH

使用したソースは、/ etc /設定がされているプロファイル
を削除またはシステムが新しいmy.cnfの/アプリケーション/ mysqlの/ディレクトリに、来るな/etc/my.cnf名前を変更し、ファイルの属性は、MySQLに調整されます。mysql


[mysqld]
character-set-server=utf8
datadir=/application/mysql/data
socket=/application/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

[client]
character-set-server=utf8
socket=/application/mysql/mysql.sock

[mysql]
character-set-server=utf8
socket=/application/mysql/mysql.sock

6. [スタート] MySQLの
開始mysqlの

/etc/init.d/mysqld start

このとき、初期化着陸によって提供されたパスワードを使用して

# mysql -uroot -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

最も簡単な方法は、ソフトリンクを作成することであり、その場合には、UNIXの靴下に基づいて使用にmysql.sockのデフォルトのファイルシステムクライアント、

ln -s /application/mysql/mysql.sock /tmp/mysql.sock

あなたは-Sオプションを着陸mysqlコマンドを使用して、ソフトリンクを作成しない場合は、手動で訪れることができますまた、ロケーションにmysql.sockを指定
成功着陸した後、管理者パスワードを変更する必要が

alter user 'root'@'localhost' identified by '598545$kdOctamvsU';
flush privileges;

表示mysqlのステータス

mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.7.26, for linux-glibc2.12 (x86_64) using  EditLine wrapper

Connection id:      4
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     5.7.26 MySQL Community Server (GPL)
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:        /application/mysql/mysql.sock
Uptime:         7 min 56 sec

Threads: 2  Questions: 14  Slow queries: 0  Opens: 116  Flush tables: 1  Open tables: 109  Queries per second avg: 0.029
--------------

おすすめ

転載: blog.51cto.com/francis198/2411158