您现在的位置是:主页 > news > 如何查看一个网站是什么程序cms做的/全球十大网站排名
如何查看一个网站是什么程序cms做的/全球十大网站排名
admin2025/4/27 1:06:47【news】
简介如何查看一个网站是什么程序cms做的,全球十大网站排名,东莞免费自助建站模板,可以做高中题目的网站7.1 问题 本例要求掌握MariaDB数据库用户账号的授权操作,完成下列任务: 1)授权数据库用户 zhsan ,密码为 pwd123 允许从本机访问,对所有库有任何权限 允许从192.168.10.0/24网段访问,对所有库有任何权限…
7.1 问题
本例要求掌握MariaDB数据库用户账号的授权操作,完成下列任务:
1)授权数据库用户 zhsan ,密码为 pwd@123
允许从本机访问,对所有库有任何权限
允许从192.168.10.0/24网段访问,对所有库有任何权限
2)查看 zhsan@localhost 的权限,并验证权限
执行 mysql -uzhsan -ppwd@123 连接数据库
连接成功以后,尝试创建新库 zhsandb
3)撤销 zhsan@localhost 的权限,再次验证权限
重新执行 mysql -uzhsan -ppwd@123 连接数据库
连接成功以后,尝试删除新库 zhsandb
7.2 步骤
实现此案例需要按照如下步骤进行。
步骤一:授权数据库用户 zhsan ,密码为 pwd@123
首先要确保当前在MariaDB交互环境,而且是以数据库的root管理员登录。
root@kali:~# mysql -uroot -ppwd@123
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 42
Server version: 10.3.20-MariaDB-1 Debian buildd-unstable
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
然后使用GRANT语句执行操作。
1)允许从本机访问,对所有库有任何权限
MariaDB [(none)]> GRANT all ON *.* TO zhsan@localhost IDENTIFIED BY 'pwd@123';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]>
2)允许从192.168.10.0/24网段访问,对所有库有任何权限
MariaDB [(none)]> GRANT all ON *.* TO zhsan@'192.168.10.%' IDENTIFIED BY 'pwd@123';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]>
步骤二:查看 zhsan@localhost 的权限,并验证权限
管理员root使用SHOW GRANTS查看指定数据库用户的权限。
MariaDB [(none)]> SHOW GRANTS FOR zhsan@localhost;
+-----------------------------------------------------------------------------------------------------------------------+
| Grants for zhsan@localhost |
+-----------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'zhsan'@'localhost' IDENTIFIED BY PASSWORD '*760F60073FD235571A5260444301DB22136ED604' |
+-----------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)
MariaDB [(none)]>
若要测试另一个用户的数据库访问权限,需要退出重新登录。
1)执行 mysql -uzhsan -ppwd@123 连接数据库
退出原来登录的数据库环境,重新以zhsan的身份登录。
MariaDB [(none)]> quit //退出原来的root环境
Bye
root@kali:~# mysql -uzhsan -ppwd@123 //重新以zhsan登录
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 43
Server version: 10.3.20-MariaDB-1 Debian buildd-unstable
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
2)连接成功以后,尝试创建新库 zhsandb
MariaDB [(none)]> CREATE DATABASE zhsandb; //测试创建新库
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> SHOW DATABASES; //检查建库结果
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| studb |
| zhsandb | //结果中已包含zhhsandb库
+--------------------+
5 rows in set (0.000 sec)
MariaDB [(none)]>
步骤三:撤销 zhsan@localhost 的权限,再次验证权限
要撤销zhsan的权限,需要再次以root登录。
MariaDB [(none)]> quit //退出原来的zhsan环境
Bye
root@kali:~# mysql -uroot -ppwd@123 //重新以root登录
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 44
Server version: 10.3.20-MariaDB-1 Debian buildd-unstable
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
然后由管理员root使用REVOKE撤销指定用户的权限。
MariaDB [(none)]> REVOKE all ON *.* FROM zhsan@localhost; //撤销权限
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> SHOW GRANTS FOR zhsan@localhost; //查看结果
+--------------------------------------------------------------------------------------------------------------+
| Grants for zhsan@localhost |
+--------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'zhsan'@'localhost' IDENTIFIED BY PASSWORD '*760F60073FD235571A5260444301DB22136ED604' |
+--------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec) //保留最基本的USAGE权限(仅登录)
MariaDB [(none)]>
撤销权限完毕以后,可以再次测试zhsan的数据库访问权限,参考下述操作。
1)重新执行 mysql -uzhsan -ppwd@123 连接数据库
MariaDB [(none)]> quit //退出原来的root环境
Bye
root@kali:~# mysql -uzhsan -ppwd@123 //重新以zhsan登录
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 43
Server version: 10.3.20-MariaDB-1 Debian buildd-unstable
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
2)连接成功以后,尝试删除新库 zhsandb
MariaDB [(none)]> DROP DATABASE zhsandb;
ERROR 1044 (42000): Access denied for user 'zhsan'@'localhost' to database 'zhsandb' //拒绝删库操作
MariaDB [(none)]>
MariaDB [(none)]> show databases; //连看到zhsandb库的机会都没有
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.000 sec)
MariaDB [(none)]>