首页 技术 正文
技术 2022年11月14日
0 收藏 639 点赞 2,964 浏览 1155 个字

授权操作只能用root账号,其他账号都不行

创建一个mike账号

mysql> create user 'mike'@'localhost' identified by '';
Query OK, 0 rows affected (0.08 sec)

查看是否创建账号

select * from mysql.user\G;

默认创建账号 在user表里没有放行授权 红色框是权限

mysql 权限管理 记录

但这个账号在其他表会有权限 例如 db表

select * from mysql.db\G;

user 是空的 包括任意用户,包括创建的mike账号  ,在db表里都有权限

HOST %  代表包括任意ip ,包括远程和本地

mysql 权限管理 记录

mike这个用户 对test这个库有权限,还对test_开头的库有权限

创建两个库测试下

mysql> create database test_1 charset=utf8;
Query OK, 1 row affected (0.13 sec)mysql> create database test2 charset=utf8;
Query OK, 1 row affected (0.00 sec)

退出重新登录

mysql> exit
Bye
[root@mysql ~]# mysql -umike -p123
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.6.36 Source distributionCopyright (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>

没有test2库,可以看到test、test_1数据库,可以对test、test_1数据库,里面的表进行增删改查

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
| test_1 |
+--------------------+
3 rows in set (0.05 sec

db表默认对test库放行权限,默认如果想针对某个库,就要对db这张表授权了

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,490
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,905
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,738
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,491
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,129
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,292