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>

    完工

  • 相关阅读:
    Centos 设置时区
    编译安装squid3.1亲测
    单点登录(SSO)的实现—通行证的基本原理
    squid反向代理基本概述及性能事项
    tmpfs加速并降低squid负载(一)
    sencha touch 2中list控件分组排序
    解决Sencha Touch 2 MVC部署App.json不被识别问题
    st大量参数提交方案参考
    Sencha Touch 载入base64格式的图片数据
    解决Sencha Touch 2 MVC部署App.json不被识别问题
  • 原文地址:https://www.cnblogs.com/xzlive/p/15152620.html
Copyright © 2011-2022 走看看