zoukankan      html  css  js  c++  java
  • mysql5.6.24 版本上创建实例并授权操作

    以下操作命令和方法均是在 mysql5.6.24 版本上,其他版本略有差异。

    一、登录mysql

    [root@db-1-198 ~]# mysql -h127.0.0.1 -uroot -p'DbMingX28' -P3306 -S /tmp/mysql3306.sock
    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 26611867
    Server version: 5.6.24-log MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2015, 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>

    二、查看现有的数据库实例

    mysql> show databases;
    +------------------------+
    | Database         |
    +------------------------+
    | information_schema |
    | mysql |
    | performance_schema |
    | test |
    +------------------------+
    4 rows in set (0.01 sec)

    三、创建数据库实例

    mysql> show databases;
    +------------------------+
    | Database |
    +------------------------+
    | information_schema |
    | mysql |
    | performance_schema |
    | test |
    +------------------------+
    4 rows in set (0.01 sec)

    四、创建用户并授权该实例的所有权限给新创建的用户

    mysql> grant all on wangming.* to 'wmuser'@'192.168.1.%' identified by 'Pz4p6uA13K';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.03 sec)
    
    mysql> show grants for 'wmuser'@'192.168.1.%';
    +-----------------------------------------------------------------------------------------------------------------------+
    | Grants for wmuser@192.168.1.% |
    +-----------------------------------------------------------------------------------------------------------------------+
    | GRANT USAGE ON *.* TO 'wmuser'@'192.168.1.%' IDENTIFIED BY PASSWORD '*4C1597C9C4060CCA85B46F5851DFEEEAF2BE459F' |
    | GRANT ALL PRIVILEGES ON `wmuser`.* TO 'wmuser'@'192.168.1.%' |
    +-----------------------------------------------------------------------------------------------------------------------+
    2 rows in set (0.00 sec)

    五、使用新创建的用户测试登录

    [root@db-1-198 ~]# mysql -h192.168.1.198 -uwmuser -p'Pz4p6uA13K' -P3306 -S /tmp/mysql3306.sock
    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 26612703
    Server version: 5.6.24-log MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2015, 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 |
    | pre_assessrv_wl |
    | test |
    +--------------------+
    3 rows in set (0.00 sec)
    
    mysql>

    完工

  • 相关阅读:
    html中的marquee属性
    XML处理指令
    h5中的结构元素header、nav、article、aside、section、footer介绍
    IndexedDB:浏览器里的本地数据库
    【我的物联网成长记7】物联网主流通信协议解读【华为云分享】
    还在为运维烦恼?体验云上运维服务,提意见赢好礼!【华为云分享】
    机器学习笔记(八)---- 神经网络【华为云分享】
    【华为云分享】机器学习笔记(七) ---- 贝叶斯分类
    【华为云分享】MongoDB-系统时钟跳变引发的风波
    【Python成长之路】Python爬虫 --requests库爬取网站乱码(xe4xb8xb0xe5xa)的解决方法【华为云分享】
  • 原文地址:https://www.cnblogs.com/xzlive/p/15152620.html
Copyright © 2011-2022 走看看