巨集病毒的簡單分析——todo,待實踐
一、關閉防火牆並安裝epel源
1、關閉selinux
①修改selinux的配置檔案
[root@localhost ~]# vim /etc/selinux/config
SELINUX=disabled
②關閉selinux
[root@localhost ~]# setenforce 0
2、關閉防火牆
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl enable firewalld
3、安裝epel.repo源
[root@localhost ~]# yum -y install epel-release.noarch
[root@localhost ~]# cd /etc/yum.repos.d/
4、安裝MySQL Repository的yum源
[root@localhost ~]# wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm #下載MySQL的yum源包
[root@localhost ~]# yum -y install mysql57-community-release-el7-11.noarch.rpm #安裝MySQL官方yum源或者使用 rpm -ivh
[root@localhost ~]# cd /etc/yum.repos.d/ #檢視MySQL的yum源
[root@localhost yum.repos.d]# ls
CentOS-Base.repo mysql-community-source.repo mysql-community.repo nginx.repo mysql57-community-release-el7-11.noarch.rpm
5、安裝MySQL
①需要安裝MySQL Server,MySQL client 已經包括在server套件內
[root@localhost yum.repos.d]# yum -y install mysql-community-server mysql #安裝MySQL的服務端和客戶端
安裝報錯:【失敗的軟體包是:mysql-community-libs-compat-5.7.38-1.el7.x86_64
GPG 金鑰配置為:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql】
解決方法:【rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022】,解決後,在重新安裝mysql
②重啟MySQL服務、查詢初始密碼
[root@www yum.repos.d]# systemctl restart mysqld
[root@www yum.repos.d]# grep 'password' /var/log/mysqld.log
2022-05-23T09:12:46.633248Z 1 [Note] A temporary password is generated for root@localhost: .Ajn3ihl;OaF
③登入並進入MySQL資料庫
[root@www yum.repos.d]# mysql -uroot -p'.Ajn3ihl;OaF'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.38
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
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>
④修改MySQL中root使用者的登陸密碼
mysql> alter user 'root'@'localhost' identified by '6a.Ajn3ihlOaF';
備註:可以通過“\q”或者“exit”退出MySQL資料庫
⑤通過root使用者登陸新密碼
[root@www yum.repos.d]# mysql -uroot -p'6a.Ajn3ihlOaF'
[root@www yum.repos.d]# systemctl restart mysqld
⑥建立一個數據庫llg_db,並設定utf8字符集
mysql> create database llg_db character set utf8 collate utf8_bin; #建立一個數據庫並設定字符集
mysql> show databases; #檢視已有資料庫
+-----------------------------+
| Database |
+-----------------------------+
| information_schema |
| llg_db |
| mysql |
| performance_schema |
| sys |
+------------------------------+
5 rows in set (0.00 sec)
⑦給資料庫授權(查詢 插入 修改 刪除 建立等 )
mysql> grant select,insert,update,delete,create,drop,alter,index on llg_db.* to 'userllg'@'localhost' identified by '6a.Ajn3ihlOaF'; #新增基本許可權,給llg_db所有表
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges; #重新整理
Query OK, 0 rows affected (0.00 sec)
mysql> show grants for 'userllg'@'localhost'; #檢視使用者userllg的許可權
+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for userllg@localhost |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'userllg'@'localhost' |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `llg_db`.* TO 'userllg'@'localhost' |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
⑧將MySQL服務設定開機自啟
[root@www yum.repos.d]# systemctl enable mysqld