• mysql新增用户


      新开了个项目,数据库也想新搞个用户,先登陆mysql,看看原来都有哪些:

    root@wlf:/# mysql -uroot -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 76766
    Server version: 5.7.26-log MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2019, 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> select host,user from mysql.user;
    +-----------+---------------+
    | host      | user          |
    +-----------+---------------+
    | %         | backup        |
    | %         | hellodevelop     |
    | %         | hellocloud       |
    | %         | passerby      |
    | %         | hellomg         |
    | localhost | mysql.session |
    | localhost | mysql.sys     |
    | localhost | root          |
    +-----------+---------------+
    8 rows in set (0.00 sec)

      我们新增一个prize用户:

    mysql> create user 'prize'@'%' identified by 'prize';
    Query OK, 0 rows affected (0.11 sec)
    
    mysql> select host,user from mysql.user;
    +-----------+---------------+
    | host      | user          |
    +-----------+---------------+
    | %         | backup        |
    | %         | hellodevelop     |
    | %         | hellocloud       |
    | %         | passerby      |
    | %         | prize         |
    | %         | hellomg         |
    | localhost | mysql.session |
    | localhost | mysql.sys     |
    | localhost | root          |
    +-----------+---------------+
    9 rows in set (0.00 sec)

      

      但这会儿新用户是没有任何操作权限的,除了看看:

    mysql> show grants for 'prize'@'%';
    +-----------------------------------+
    | Grants for prize@%                |
    +-----------------------------------+
    | GRANT USAGE ON *.* TO 'prize'@'%' |
    +-----------------------------------+
    1 row in set (0.00 sec)

      

      所以我们还得给它赋予各种权限:

    mysql> grant all privileges on `prize`.* to 'prize'@'%';
    Query OK, 0 rows affected (0.04 sec)
    
    mysql> show grants for 'prize'@'%';
    +--------------------------------------------------+
    | Grants for prize@%                               |
    +--------------------------------------------------+
    | GRANT USAGE ON *.* TO 'prize'@'%'                |
    | GRANT ALL PRIVILEGES ON `prize`.* TO 'prize'@'%' |
    +--------------------------------------------------+
    2 rows in set (0.00 sec)

      刷新一下权限:

    mysql> flush privileges;
    Query OK, 0 rows affected (0.09 sec)

      现在可以进入prize用户开始我们的倒腾了:

    mysql> exit;
    Bye
    root@d5afa9102517:/# mysql -uprize -pprize
    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 77055
    Server version: 5.7.26-log MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2019, 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> create database prize;
    Query OK, 1 row affected (0.09 sec)
  • 相关阅读:
    比较Activiti中三种不同的表单及其应用
    Liferay7 BPM门户开发之2: BPMN 2.0 规范入门 (Activiti BPMN extensions)
    activiti学习笔记 ----------------------------FormService
    activiti学习笔记---managementService
    Activiti5 学习笔记—— comment 批注
    Activiti6-流程跟踪监控图-节点-流程线高亮显示-支持通过、不通过、驳回、退回
    Activiti 快速入门教程:SpringBoot 集成 Activiti6 + Activiti Modeler 流程配置可视化
    工作流学习——Activiti流程变量五步曲
    利用Python中的mock库对Python代码进行模拟测试
    密码校验正则 -- 数字、字符、特殊符号
  • 原文地址:https://www.cnblogs.com/wuxun1997/p/12066237.html
Copyright © 2020-2023  润新知