hellopasswd

MySQL创建用户以及授权

grant all on . to 'user1' identified by 'passwd';

grant SELECT,UPDATE,INSERT on db1.* to 'user2'@'192.169.9.1' identified by 'passwd';

grant all on db1.* to 'user3'@'%' identified by 'passwd';

show grants;

创建使用指定登录用户

[root@localhost ~]# /usr/local/mysql/bin/mysql -uroot -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 8

Server version: 5.6.36 MySQL Community Server (GPL)

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> grant all on *.* to 'user1'@'127.0.0.1' identified by '123a';

Query OK, 0 rows affected (0.10 sec)

mysql> quit

Bye

登录用户

[root@localhost ~]# /usr/local/mysql/bin/mysql -uuser1 -p123a

Warning: Using a password on the command line interface can be insecure.

ERROR 1045 (28000): Access denied for user 'user1'@'localhost' (using password: YES)

需要指定IP,使用socket

[root@localhost ~]# /usr/local/mysql/bin/mysql -uuser1 -p123a -h127.0.0.1

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 10

Server version: 5.6.36 MySQL Community Server (GPL)

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> quit

Bye

注意grant语句并不会记录在历史命令当中

创建使用socket登录用户

[root@localhost ~]# /usr/local/mysql/bin/mysql -uroot -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 11

Server version: 5.6.36 MySQL Community Server (GPL)

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> grant all on *.* to 'user1'@'localhost' identified by '123a';

Query OK, 0 rows affected (0.02 sec)

mysql> quit

Bye

登录用户

[root@localhost ~]# /usr/local/mysql/bin/mysql -uuser1 -p123a

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 12

Server version: 5.6.36 MySQL Community Server (GPL)

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> quit

Bye

mysql> show grants;

+----------------------------------------------------------------------------------------------------------------------------------------+

| Grants for root@localhost |

+----------------------------------------------------------------------------------------------------------------------------------------+

| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*23AE809DDACAF96AF0FD78ED04B6A265E05AA257' WITH GRANT OPTION |

| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |

+----------------------------------------------------------------------------------------------------------------------------------------+

2 rows in set (0.02 sec)

mysql> show grants for user1@'127.0.0.1';

+-----------------------------------------------------------------------------------------------------------------------+

| Grants for user1@127.0.0.1 |

+-----------------------------------------------------------------------------------------------------------------------+

| GRANT ALL PRIVILEGES ON *.* TO 'user1'@'127.0.0.1' IDENTIFIED BY PASSWORD '*318A97B79A244462B853FC344402458373343CFF' |

+-----------------------------------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)

show grants for user2@'192.168.133.1';

修改于 180116

centos 7 mysql 创建用户_【CentOS 7MySQL常用操作4】,MySQL创建用户以及授权#180116相关推荐

  1. 如何用mysql创建数据仓库_数据仓库入门(实验1)创建数据源

    首先需要创建一个数据源,SSAS(分析服务)将利用数据源来连接源数据库.一.准备环境1.准备SQLServer 安装一台SQLServer2012.2.安装DEMO数据库 下载一个演示 首先需要创建一 ...

  2. docker容器mysql头文件_在Docker容器中使用MySQL数据库

    开发过程中经常需要安装.调试mysql数据库,还需要在各种操作系上安装包依赖,实在是繁琐,因此就研究了一下如何在docker上运行一个mysql镜像,省却了我安装.找依赖的问题. 注:本文所有内容均在 ...

  3. linux mysql 打补丁_一步到位Linux中安装配置MySQL及补坑

    Windows上安装MySQL也就不讲了,基本上一路点击下一步就可完成,现在讲讲Linux上布署Mysql,虽然也有很多网友列出了详细的步骤,可能是因为版本过老的问题导致即使按照上面一步步来也还是出现 ...

  4. mysql long类型_怒肝两个月MySQL源码,我总结出这篇2W字的MySQL协议详解(超硬核干货)!!...

    点击上方蓝色"冰河技术",关注并选择"设为星标" 持之以恒,贵在坚持,每天进步一点点! 作者个人研发的在高并发场景下,提供的简单.稳定.可扩展的延迟消息队列框架 ...

  5. 关于mysql的项目_项目中常用的MySQL 优化

    本文我们来谈谈项目中常用的MySQL优化方法,共19条,具体如下: 一.EXPLAIN 做MySQL优化,我们要善用EXPLAIN查看SQL执行计划. 下面来个简单的示例,标注(1.2.3.4.5)我 ...

  6. mysql 默认时间_使用Sysbench对滴滴云MySQL进行基准测试

    Sysbench是一款开源的多线程.跨平台的基准测试工具,可以执行CPU/内存/线程/IO/数据库等方面的性能测试.本文使用Sysbench针对滴滴云的MySQL进行基准测试. 本文使用的MySQL数 ...

  7. 负载均衡mysql的使用_使用负载均衡集群集化 MySQL - Azure Virtual Machines | Microsoft Docs...

    使用负载均衡的集来群集化 Linux 上的 MySQL 04/14/2015 本文内容 重要 经典 VM 将于 2023 年 3 月 1 日停用. 如果从 ASM 使用 IaaS 资源,请在 2023 ...

  8. mysql级联删除_每天学一点学点MySQL数据库之第二节

    三.快速安装运行MySQL数据库 MySQL以前一直是开源免费的,被Oracle收购后有些变化:以前的版本都是免费的,社区版按GPL协议开源免费,商业版提供更加丰富的功能,但收费. 社区版的下载地址: ...

  9. mysql 魔乐_魔乐科技 李--兴--华 企业级架构会话授权管理 OAuth

    资源内容: 魔乐科技 李--兴--华 企业级架构会话授权管理 OAuth|____OAuth代码.rar|____200301h_springcloud与oauth统一认证(springcloud整合 ...

  10. mysql++裸盘_记一次裸迁 MySQL 经历

    记一次裸迁MySQL经历 前言:博主企业有一台企业阿里云机器,因为安装了云锁,造成服务器动不动就给我所死服务器.(就是那种 chattr +i /bin/bash ,分分钟日死狗 )趁着周末,Boos ...

最新文章

  1. 剑指offer:面试题06. 从尾到头打印链表
  2. 小程序获取用户手机号_社区团购小程序应该如何推广才能获取更多用户?
  3. docker基本操作
  4. 晶科能源坐稳全球光伏组件制造商“头把交椅”
  5. zuul 网关的用途_Zuul网关
  6. BZOJ2459 : [BeiJing2011]神秘好人
  7. 数据结构——顺序栈和链式栈的简单实现和解析(C语言版)
  8. 使用ASM 4处理Java类文件–第一部分:世界,您好!
  9. 【Vegas2008】9月19日-青椒炒南瓜
  10. Meta开发了一个AI模型,尝试解决维基百科的「性别偏见」问题
  11. wps的excel中的单元格限定输入的内容
  12. 二、Spring MVC之常用注解
  13. S. gcc相关软件安装
  14. 设置iis支持wap服务
  15. 计算机开机不正常运行,win7 64位旗舰版电脑开机启动不正常怎么办
  16. vsftpd创建虚拟用户,解决本地用户不安全问题,增强服务器安全性
  17. win32com 读取excel
  18. Nginx配置文件详解
  19. 受众引擎亮相百度世界 联盟产品进入3.0时代
  20. 期权期货及其它衍生品笔记——第三章利用期货的对冲策略

热门文章

  1. Java-001-面向对象
  2. 任何社区,只要能影响他人成长的人,都可以成为敏捷个人的荣誉会员
  3. Llinux课程计划安排
  4. 006 Spark中的wordcount以及TopK的程序编写
  5. 分享一个C#读取计算机信息的类
  6. 安装Hadoop系列 — 导入Hadoop源码项目
  7. [转载] 七龙珠第一部——第031话 假悟空出现
  8. 缩略图在网页设计中应用的35个优秀案例
  9. LCS005标准版部署之三
  10. 学python有什么好处 学完可以做什么