溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

掌握銀行Redhat7無網(wǎng)如何部署Mysql.5.7的詳細(xì)教程

發(fā)布時(shí)間:2020-06-04 11:26:37 來源:網(wǎng)絡(luò) 閱讀:365 作者:三月 欄目:MySQL數(shù)據(jù)庫

本篇文章給大家主要講的是關(guān)于銀行Redhat7無網(wǎng)如何部署Mysql.5.7的詳細(xì)教程的內(nèi)容,感興趣的話就一起來看看這篇文章吧,相信看完銀行Redhat7無網(wǎng)如何部署Mysql.5.7的詳細(xì)教程對大家多少有點(diǎn)參考價(jià)值吧。

1.需求就不用講了,客戶現(xiàn)場,政府環(huán)境,銀行環(huán)境,大多是沒網(wǎng)的,所以無網(wǎng)安裝是很有必要的

mysql下載路徑:https://dev.mysql.com/downloads/mysql/

掌握銀行Redhat7無網(wǎng)如何部署Mysql.5.7的詳細(xì)教程


查看自己Linux系統(tǒng)版本

1
2
[root@lsl ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

 

往下拉繼續(xù)選擇

掌握銀行Redhat7無網(wǎng)如何部署Mysql.5.7的詳細(xì)教程


選擇對應(yīng)的下載,mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar

這樣幾分鐘就下載了。

2.準(zhǔn)備依賴包:

a.numactl 軟件包:

  • numactl-2.0.9-6.el7_2.x86_64.rpm

  • numactl-devel-2.0.9-6.el7_2.x86_64.rpm

  • numactl-libs-2.0.9-6.el7_2.x86_64.rpm

b.其他相關(guān)支持:

  • perl-Data-Dumper-2.145-3.el7.x86_64.rpm

  • libaio-0.3.109-13.el7.x86_64.rpm

下載方式:https://pkgs.org

掌握銀行Redhat7無網(wǎng)如何部署Mysql.5.7的詳細(xì)教程

下面是下載路徑:

libaio-0.3.109-13.el7.x86_64.rpm

perl-Data-Dumper-2.145-3.el7.x86_64.rpm

numactl-libs-2.0.9-6.el7_2.x86_64.rpm

numactl-devel-2.0.9-6.el7_2.x86_64.rpm

numactl-2.0.9-6.el7_2.x86_64.rpm

3.上傳文件到云服務(wù)器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

localhost:Downloads lsl$ scp -r numactl-2.0.9-6.el7_2.x86_64.rpm 

root@kylintest:/root/

root@lsl's password:
numactl-2.0.9-6.el7_2.x86_64.rpm              100%   65KB   2.1MB/s   00:00   

localhost:Downloads lsl$ scp -r numactl-libs-2.0.9-6.el7_2.x86_64.rpm 

root@lsl:/root/

root@lsl's password:
numactl-libs-2.0.9-6.el7_2.x86_64.rpm         100%   29KB   1.7MB/s   00:00   

localhost:Downloads kylin$ scp -r numactl-devel-2.0.9-6.el7_2.x86_64.rpm 

root@lsl:/root/

root@lsl's password:
numactl-devel-2.0.9-6.el7_2.x86_64.rpm        100%   23KB   1.5MB/s   00:00   

localhost:Downloads lsl$ scp -r perl-Data-Dumper-2.145-3.el7.x86_64.rpm 

root@lsl:/root/

root@lsl's password:
perl-Data-Dumper-2.145-3.el7.x86_64.rpm       100%   47KB   1.2MB/s   00:00   

localhost:Downloads lsl$ scp -r libaio-0.3.109-13.el7.x86_64.rpm 

root@lsl:/root/

root@lsl's password:
Permission denied, please try again.
root@lsl's password:
libaio-0.3.109-13.el7.x86_64.rpm              100%   24KB 618.3KB/s   00:00   

localhost:Downloads lsl$ scp -r mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar 

root@lsl:/root/

root@lsl's password:
mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar       100%  566MB   4.5MB/s   02:05

 查看上傳的包

1
2
3
4
5
6
[root@lsl ~]# ls
anaconda-ks.cfg                           numactl-devel-2.0.9-6.el7_2.x86_64.rpm
libaio-0.3.109-13.el7.x86_64.rpm          numactl-libs-2.0.9-6.el7_2.x86_64.rpm
miniconda2                                perl-Data-Dumper-2.145-3.el7.x86_64.rpm
mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar  pythonshell
numactl-2.0.9-6.el7_2.x86_64.rpm

 4.安裝

第一步,先安裝依賴,安裝 perl-Data-Dumper-2.145-3.el7.x86_64.rpm 和 libaio-0.3.109-13.el7.x86_64.rpm

1
2
3
4
5
6
7
[root@lsl ~]# rpm -ivh libaio-0.3.109-13.el7.x86_64.rpm
Preparing...                          ################################# [100%]
    package libaio-0.3.109-13.el7.x86_64 is already installed
[root@lsl ~]# rpm -ivh perl-Data-Dumper-2.145-3.el7.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:perl-Data-Dumper-2.145-3.el7     ################################# [100%]

 第二步,繼續(xù)安裝 numactl相關(guān)

1
2
3
[root@lsl ~]# rpm -ivh numactl*
Preparing...                          ################################# [100%]
package numactl-libs-2.0.9-6.el7_2.x86_64 is already installed

 如果不安裝這個(gè)包會報(bào)錯(cuò),錯(cuò)誤如下(本人未測試):

1
2
3
4
5
6
7
error: Failed dependencies:
  
libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64
  
libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64
  
libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64 

 若此時(shí)直接安裝mysql,還會異常:

1
2
3
warning: mysql-community-libs-5.7.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies:
 mysql-community-common(x86-64) >= 5.7.9 is needed by mysql-community-libs-5.7.18-1.el7.x86_64
 mariadb-libs is obsoleted by mysql-community-libs-5.7.18-1.el7.x86_64

  第一行還能看明白,是依賴問題,第二行的“mariadb-libs 被廢棄”是什么鬼?廢棄了為什么不提供一個(gè)新的還要出現(xiàn)這種弱智提示呢?

經(jīng)過一番搜尋,才發(fā)現(xiàn)是因?yàn)樵贑entOS 7上已經(jīng)有一個(gè)mariadb 而這個(gè)會與 MySQL的mariadb發(fā)生沖突。所以此時(shí)我們需要將系統(tǒng)自帶的mariadb卸載掉,

然后使用mysql自帶的mariadb。

接下來查看mariadb版本

1
2
[root@lsl ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.52-1.el7.x86_64

 卸載系統(tǒng)安裝的mariadb

1
2
3
[root@lsl ~]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
[root@lsl ~]# rpm -qa | grep mariadb
[root@lsl ~]#

  解決好這個(gè)問題后,就可以安裝mysql了,先解壓mysql,并查看安裝包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[root@lsl ~]# tar -xf mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar
[root@lsl ~]# ls
anaconda-ks.cfg
libaio-0.3.109-13.el7.x86_64.rpm
miniconda2
mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-5.7.20-1.el7.x86_64.rpm
mysql-community-common-5.7.20-1.el7.x86_64.rpm
mysql-community-devel-5.7.20-1.el7.x86_64.rpm
mysql-community-embedded-5.7.20-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.20-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.20-1.el7.x86_64.rpm
mysql-community-libs-5.7.20-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.20-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.20-1.el7.x86_64.rpm
mysql-community-server-5.7.20-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.20-1.el7.x86_64.rpm
mysql-community-test-5.7.20-1.el7.x86_64.rpm
numactl-2.0.9-6.el7_2.x86_64.rpm
numactl-devel-2.0.9-6.el7_2.x86_64.rpm
numactl-libs-2.0.9-6.el7_2.x86_64.rpm
perl-Data-Dumper-2.145-3.el7.x86_64.rpm
pythonshell

 直接安裝,報(bào)錯(cuò):

1
2
3
4
5
[root@lsl ~]# rpm -ivh mysql-community-*
warning: mysql-community-client-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
    net-tools is needed by mysql-community-server-5.7.20-1.el7.x86_64
    perl(JSON) is needed by mysql-community-test-5.7.20-1.el7.x86_64

 貌似不能直接全安裝,有順序,繼續(xù):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@lsl ~]# rpm -ivh mysql-community-common-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-common-5.7.20-1.e################################# [100%]
[root@lsl ~]# rpm -ivh mysql-community-libs-*
warning: mysql-community-libs-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-libs-5.7.20-1.el7################################# [ 50%]
   2:mysql-community-libs-compat-5.7.2################################# [100%]
[root@lsl ~]# rpm -ivh mysql-community-devel-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-devel-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-devel-5.7.20-1.el################################# [100%]
[root@lsl ~]#
[root@lsl ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
    mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.20-1.el7.x86_64
    net-tools is needed by mysql-community-server-5.7.20-1.el7.x86_64

 

說缺少net-tools ,下載下來裝唄,繼續(xù):

net-tools-2.0-0.22.20131004git.el7.x86_64.rpm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[root@lsl ~]# rpm -ivh net-tools-2.0-0.22.20131004git.el7.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:net-tools-2.0-0.22.20131004git.el################################# [100%]
[root@lsl ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
    mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.20-1.el7.x86_64
[root@lsl ~]# rpm -ivh mysql-community-c
mysql-community-client-5.7.20-1.el7.x86_64.rpm  mysql-community-common-5.7.20-1.el7.x86_64.rpm
[root@lsl ~]# rpm -ivh mysql-community-client-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-client-5.7.20-1.e################################# [100%]
[root@lsl ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-server-5.7.20-1.e################################# [100%]

 中間安裝server時(shí),又說必須安裝client,至此,mysql安裝成功,打完收工。

5.啟動查看配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@lsl ~]# service mysqld start 或 systemcl start mysqld 
Redirecting to /bin/systemctl start  mysqld.service
[root@lsl ~]# service mysqld status
Redirecting to /bin/systemctl status  mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2017-11-04 13:56:37 CST; 24s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 4644 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 4571 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 4647 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─4647 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
 
Nov 04 13:56:07 kylintest systemd[1]: Starting MySQL Server...
Nov 04 13:56:37 kylintest systemd[1]: Started MySQL Server.

 至此,無網(wǎng)安裝難的歷史已經(jīng)結(jié)束,至少的我實(shí)驗(yàn)沒問題了,好像還缺點(diǎn)是什么,數(shù)據(jù)庫密碼是啥?

1
2
[root@lsl ~]# cat /var/log/mysqld.log | grep password

2017-11-04T05:56:08.454323Z 1 [Note] A temporary password is generated for 

root@localhost: ps1DY?%T.Vc4

這樣就可以登錄數(shù)據(jù)庫了,try一下:

1
2
[root@lsl ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

 報(bào)錯(cuò)了,連輸入密碼的機(jī)會也沒有。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@lsl ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.20
 
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>

 登陸成功試試,數(shù)據(jù)庫好使不

1
2
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

 不改密碼,用不了,繼續(xù):

1
2
3
4
5
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密碼';
Query OK, 0 rows affected (0.02 sec)
 
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

 然后再使用SQL就沒問題了

1
2
3
4
5
6
7
8
9
10
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

 用數(shù)據(jù)庫工具鏈接,出現(xiàn)問題:

掌握銀行Redhat7無網(wǎng)如何部署Mysql.5.7的詳細(xì)教程

 

不允許遠(yuǎn)程訪問,改繼續(xù):

1
2
3
4
5
mysql>  GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密碼' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
 
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

 再試就沒有問題了,至此數(shù)據(jù)庫安裝問題基本沒有。

查看mysql配置文件地址:

1
2
3
4
5
6
[root@lsl ~]# find / -iname '*.cnf' -print
/etc/pki/tls/openssl.cnf
/etc/my.cnf
/root/miniconda2/pkgs/openssl-1.0.2l-0/ssl/openssl.cnf
/root/miniconda2/ssl/openssl.cnf
/var/lib/mysql/auto.cnf

 查看字符集:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
mysql> show variables like 'char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)

 至此數(shù)據(jù)庫安裝完畢。

以上關(guān)于銀行Redhat7無網(wǎng)如何部署Mysql.5.7的詳細(xì)教程詳細(xì)內(nèi)容,對大家有幫助嗎?如果想要了解更多相關(guān),可以繼續(xù)關(guān)注我們的行業(yè)資訊板塊。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI