zoukankan      html  css  js  c++  java
  • 5.7.27版本mysql新增用户

      因为我们目前只有root,所以只能先用root登陆mysql,再新增用户:

    $ bin/mysql -u root -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 3
    Server version: 5.7.27 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> insert into mysql.user(Host,User,ssl_cipher,x509_issuer,x509_subject) values('localhost', 'wlf','','','');
    Query OK, 1 row affected (0.00 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

      接着我们给新用户wlf设置密码:

    mysql> set password for 'wlf'@'localhost' = password('wlf123');
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

      然后我们新建数据库,并给wlf用户赋予权限,登陆口令跟wlf的密码一致:

    mysql> create database nacos_config;
    Query OK, 1 row affected (0.00 sec)
    
    mysql> grant all privileges on nacos_config.* to wlf@localhost identified by 'wlf123';
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

      用wlf登陆后查看数据库,发现nacos_config已经建好了

    [wlf@zjhz-cmread-test188 mysql]$ bin/mysql -u wlf -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 13
    Server version: 5.7.27 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> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | nacos_config       |
    +--------------------+
    2 rows in set (0.00 sec)
  • 相关阅读:
    FMDB(一)— 简单介绍
    产品设计之设计理念
    整理了一下浅墨大神的Visual C++/DirectX 9.0c的游戏开发手记
    使用scp免passwordserver间传递文件
    游戏架构其一:经常使用工具集合
    Failed to import package with error: Couldn't decompress package
    【从0開始Tornado建站】0.9版本号python站点代码开源--持续更新中
    【Android】 给我一个Path,还你一个酷炫动画
    codeforces Round #Pi (div.2) 567ABCD
    linux 查看磁盘使用情况
  • 原文地址:https://www.cnblogs.com/wuxun1997/p/11556603.html
Copyright © 2011-2022 走看看