中文字幕日韩精品一区二区免费_精品一区二区三区国产精品无卡在_国精品无码专区一区二区三区_国产αv三级中文在线

RHEL7.2如何安裝二進(jìn)制MySQL5.7.18-創(chuàng)新互聯(lián)

這篇文章給大家分享的是有關(guān)RHEL 7.2如何安裝二進(jìn)制MySQL 5.7.18的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。

10年積累的成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問(wèn)題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先網(wǎng)站制作后付款的網(wǎng)站建設(shè)流程,更有云南免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

環(huán)境:

Red Hat Enterprise Linux Server release 7.2 (Maipo)

mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

安裝需求:

libaio

MySQL 5.7.19 and later 需要安裝libnuma,由于本次測(cè)試為5.7.18,不需要安裝libnuma.

如之前安裝過(guò)MySQL,清除一下目錄和文件

/etc/my.cnf or the /etc/mysql

rhel7以后需要取消RemoveIPC限制

[root@rhelb mysql]# vi /etc/systemd/logind.conf

#RemoveIPC=yes -> RemoveIPC=no

檢查軟件包是否安裝

[root@rhelb mysql]# rpm -qa | grep libaio

關(guān)閉防火墻

[root@rhelb yum.repos.d]# vi /etc/sysconfig/selinux 

SELINUX=enforcing-> SELINUX=disabled

關(guān)閉系統(tǒng)THP,rhel7以后和之前關(guān)閉THP文件有變化,rhel7及以后關(guān)閉方式如下:

[root@rhelb yum.repos.d]# cat /sys/kernel/mm/transparent_hugepage/enabled 

[always] madvise never

在quiet后添加 transparent_hugepage=never

[root@rhelb yum.repos.d]# cat /etc/default/grub 

GRUB_TIMEOUT=5

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"

GRUB_DEFAULT=saved

GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT="console"

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet transparent_hugepage=never"

GRUB_DISABLE_RECOVERY="true"

添加后重啟主機(jī)

[root@rhelb yum.repos.d]# cat /sys/kernel/mm/transparent_hugepage/enabled 

always madvise [never]

配置yum源,rhel7以后,新建一個(gè)新的yum資料庫(kù)

[root@rhelb mysql]# mount /dev/sr0 /mnt

[root@rhelb yum.repos.d]# ls -lrt

total 8

-rw-r--r--. 1 root root  91 Aug 16 23:11 rhel.repo

-rw-r--r--. 1 root root 358 Aug 16 23:12 redhat.repo

[root@rhelb yum.repos.d]# more /etc/yum.repos.d/rhel.repo 

[rhel7_server]

name=added from: file:///rhel7/dvd

baseurl=file:///mnt

enabled=1

gpgcheck=0

安裝軟件包:

[root@rhelb mysql]# yum -y install libaio.x86_64

......

Installed:

  libaio.x86_64 0:0.3.109-13.el7                                                                                                    

Complete!

MySQL二進(jìn)制目錄說(shuō)明:

DirectoryContents of Directory
binmysqld server, client and utility programs
docsMySQL manual in Info format
manUnix manual pages
includeInclude (header) files
libLibraries
shareError messages, dictionary, and SQL for database installation
support-filesMiscellaneous support files

解壓軟件:

[root@rhelb soft]# tar -xzvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz 

[root@rhelb soft]# mv mysql-5.7.18-linux-glibc2.5-x86_64 /usr/local/mysql

創(chuàng)建相關(guān)用戶:

[root@rhelb mysql]# groupadd mysql

[root@rhelb mysql]# useradd -r -g mysql -s /bin/false mysql

[root@rhelb mysql]# cd /usr/local

[root@rhelb local]# mkdir /data

[root@rhelb local]# chown -R mysql:mysql /usr/local/mysql/

[root@rhelb local]# chown -R mysql:mysql /data/

[root@rhelb local]# chmod 750 /data/

初始化數(shù)據(jù)庫(kù):

查看mysqld參數(shù):

root@rhelb mysql]# bin/mysqld --verbose --help |more

mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2 - No such file or directory)

bin/mysqld  Ver 5.7.18 for linux-glibc2.5 on x86_64 (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.

Starts the MySQL database server.

Usage: bin/mysqld [OPTIONS]

Default options are read from the following files in the given order:

/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 

The following groups are read: mysqld server mysqld-5.7

The following options may be given as the first argument:

......

[root@rhelb mysql]# ./bin/mysqld --initialize --user=mysql --basedir=/data/ --datadir=/data/

2018-08-21T09:11:34.367385Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-08-21T09:11:34.367604Z 0 [ERROR] Can't find error-message file '/data/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.

2018-08-21T09:11:34.632615Z 0 [Warning] InnoDB: New log files created, LSN=45790

2018-08-21T09:11:34.705037Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2018-08-21T09:11:34.997455Z 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: 33b8197c-a522-11e8-83a6-080027073030.

2018-08-21T09:11:35.001885Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2018-08-21T09:11:35.004186Z 1 [Note] A temporary password is generated for root@localhost: kdivr2ax2P,K

root初始化密碼kdivr2ax2P,K

[root@rhelb mysql]# ls -lrt /data/

total 110628

-rw-r----- 1 mysql mysql 50331648 Aug 21 05:11 ib_logfile1

-rw-r----- 1 mysql mysql       56 Aug 21 05:11 auto.cnf

drwxr-x--- 2 mysql mysql     8192 Aug 21 05:11 performance_schema

drwxr-x--- 2 mysql mysql     4096 Aug 21 05:11 mysql

drwxr-x--- 2 mysql mysql     8192 Aug 21 05:11 sys

-rw-r----- 1 mysql mysql      419 Aug 21 05:11 ib_buffer_pool

-rw-r----- 1 mysql mysql 50331648 Aug 21 05:11 ib_logfile0

-rw-r----- 1 mysql mysql 12582912 Aug 21 05:11 ibdata1

配置ssl,會(huì)話安全方面考慮,如不需要可以不配置

[root@rhelb mysql]# bin/mysql_ssl_rsa_setup

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'

配置參數(shù)文件,如果不配置[client]客戶端連接時(shí)提示/tmp/socket.sock

[root@rhelb etc]# vi /etc/my.cnf

[mysqld]

port = 3306

pid-file = /data/mysql3306.pid

datadir = /data/

socket = /data/mysql3306.sock

slow_query_log_file = /data/slow.log

log-error = /data/error.log

[client]

socket = /data/mysql3306.sock   

MySQL取消安全隱患:

 a)為root用戶設(shè)置密碼
  b)刪除匿名賬號(hào)
  c)取消root用戶遠(yuǎn)程登錄
  d)刪除test庫(kù)和對(duì)test庫(kù)的訪問(wèn)權(quán)限
  e)刷新授權(quán)表使修改生效

root@rhelb mysql]# bin/mysql_secure_installation 

Securing the MySQL server deployment.

Enter password for user root: 

Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

[root@rhelb mysql]# bin/mysql_secure_installation -S /data/mysql3306.sock

Securing the MySQL server deployment.

Enter password for user root: 

Error: Access denied for user 'root'@'localhost' (using password: NO)

[root@rhelb mysql]# bin/mysql_secure_installation -S /data/mysql3306.sock

Securing the MySQL server deployment.

Enter password for user root:       <<——日志中臨時(shí)生成的密碼

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password: 

VALIDATE PASSWORD PLUGIN can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: Y

There are three levels of password validation policy:

LOW    Length >= 8

MEDIUM Length >= 8, numeric, mixed case, and special characters

STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1

Using existing password for root.

Estimated strength of the password: 100 

Change the password for root ? ((Press y|Y for Yes, any other key for No) :    

 ... skipping.

By default, a MySQL installation has an anonymous user,

allowing anyone to log into MySQL without having to have

a user account created for them. This is intended only for

testing, and to make the installation go a bit smoother.

You should remove them before moving into a production

environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y

Success.

Normally, root should only be allowed to connect from

'localhost'. This ensures that someone cannot guess at

the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y

Success.

By default, MySQL comes with a database named 'test' that

anyone can access. This is also intended only for testing,

and should be removed before moving into a production

environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y

 - Dropping test database...

Success.

 - Removing privileges on test database...

Success.

Reloading the privilege tables will ensure that all changes

made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

Success.

All done! 


配置服務(wù)啟動(dòng):

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

[root@rhelb mysql]# service mysql.server start

Starting MySQL. SUCCESS! 

[root@rhelb mysql]# ps -ef | grep mysql

root      3486     1  0 05:51 pts/2    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/ --pid-file=/data/mysql3306.pid

mysql     3653  3486  6 05:51 pts/2    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/error.log --pid-file=/data/mysql3306.pid --socket=/data/mysql3306.sock --port=3306

root      3685  2711  0 05:51 pts/2    00:00:00 grep --color=auto mysql

[root@rhelb etc]# mysql -uroot -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.7.18 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> status;

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

mysql  Ver 14.14 Distrib 5.7.18, for linux-glibc2.5 (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.18 MySQL Community Server (GPL)

Protocol version:       10

Connection:             Localhost via UNIX socket

Server characterset:    latin1

Db     characterset:    latin1

Client characterset:    utf8

Conn.  characterset:    utf8

UNIX socket:            /data/mysql3306.sock

Uptime:                 12 sec

Threads: 1  Questions: 6  Slow queries: 0  Opens: 105  Flush tables: 1  Open tables: 98  Queries per second avg: 0.500

感謝各位的閱讀!關(guān)于“RHEL 7.2如何安裝二進(jìn)制MySQL 5.7.18”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!

網(wǎng)站欄目:RHEL7.2如何安裝二進(jìn)制MySQL5.7.18-創(chuàng)新互聯(lián)
鏈接URL:http://m.rwnh.cn/article48/esjhp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供全網(wǎng)營(yíng)銷(xiāo)推廣、網(wǎng)站收錄軟件開(kāi)發(fā)、虛擬主機(jī)、網(wǎng)站維護(hù)做網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁(yè)設(shè)計(jì)公司
惠来县| 平潭县| 呼玛县| 吴堡县| 泸州市| 深圳市| 贞丰县| 雷山县| 九江县| 连山| 揭西县| 瑞昌市| 海林市| 漯河市| 兴海县| 长春市| 岑巩县| 竹北市| 黄平县| 渝北区| 泸州市| 秦安县| 锡林郭勒盟| 浦江县| 青海省| 南乐县| 竹北市| 新津县| 荃湾区| 罗定市| 永新县| 彭阳县| 沾益县| 宜都市| 安乡县| 改则县| 若羌县| 班玛县| 巴彦淖尔市| 太原市| 景泰县|