暂无图片
暂无图片
3
暂无图片
暂无图片
暂无图片
Mysql数据库入门基础篇.pdf
79
15页
2次
2023-11-09
免费下载
Mysql 数据库入门基础篇--用户与权
Mysql 数据库入门基础篇--用户与权限管理
一、Mysql 用户管理
1.1  Mysql 服务器登录
1.2  用户创建
1.3  用户修改
1.4  用户删除
1.5  用户密码修改
1.6  用户密码管理
二、Mysql 权限管理
2.1  mysql 数据库权限列表
2.2  数据库授权原则
2.3  数据库授权
2.4  数据库查看权限
2.5  数据库收回权限
2.6  数据库权限表
2.7  数据库访问控制
三、总结温故知新
一、Mysql 用户管理
Mysql 用户分为 root 用户和普通用户,其中 root 用户是数据库超级管理员,拥有所有权限
(创建、删除、修改密码、授权等管理权限),普通用户只拥有被授予的权限。
Mysql 数据库的安全性通过账户管理来保障。
1.1  Mysql 服务器登录
 简单使用
[root@db-server ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.32 MySQL Community Server - GPL
Copyright (c) 2000, 2023, 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> use test01;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from tab1;
+------+--------+-------+
| id | name | class |
+------+--------+-------+
| 1001 | 曹操 | 1 |
| 1002 | 张飞 | 1 |
| 1003 | 项羽 | 3 |
| 1004 | 刘备 | 2 |
+------+--------+-------+
4 rows in set (0.00 sec)
mysql>
 复杂使用
#### mysql -h hostname|hostIP -P port -u username -p DatabaseName -e "sql 语句";
[root@db-server ~]# mysql -h localhost -P 3306 -p test01 -e "select * from tab1";
Enter password:
+------+--------+-------+
| id | name | class |
+------+--------+-------+
| 1001 | 曹操 | 1 |
| 1002 | 张飞 | 1 |
| 1003 | 项羽 | 3 |
| 1004 | 刘备 | 2 |
+------+--------+-------+
[root@db-server ~]#
1.2  用户创建
推荐使用 create user 命令创建用户,Mysql 8.0 版本移除了 password 加密方法,不再推
使用 insert user 表直接添加用户。
创建用户时,必须拥有 create user 权限,新创建的用户只有登录权限。
#####语法#####
create user '用户名'@'用户地址' identified by '密码';
mysql> create user liubei identified by 'Liubei@123456'; #默认 host %
Query OK, 0 rows affected (0.01 sec)
of 15
免费下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜