zoukankan      html  css  js  c++  java
  • Mysql 创建用户和数据库

    添加新用户:
    
    1.新建用户。
    
    //登录MYSQL
    [mysql@mysql ~]$ mysql -u test -p123456
    --只能本机登陆
    mysql> grant all privileges on *.* to test@localhost  identified by '123456' with grant option;
    Query OK, 0 rows affected (0.12 sec)
    
    格式:grant 权限 on 数据库名.表名 用户@登录主机 identified by "用户密码";
    
    
    
    可以从任何机器登陆
    GRANT ALL PRIVILEGES ON *.* TO 'test'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
    
    
    2.为用户授权。
    
    //登录MYSQL(有ROOT权限)。我里我以ROOT身份登录.
    @>mysql -u root -p
    @>密码
    
    //首先为用户创建一个数据库(phplampDB)
    mysql>create database phplampDB;
    //授权phplamp用户拥有phplamp数据库的所有权限。
    >grant all privileges on phplampDB.* to phplamp@localhost identified by '1234';
    //刷新系统权限表
    mysql>flush privileges;
    mysql>其它操作
    
    mysql> create database plmsdb;
    Query OK, 1 row affected (0.01 sec)
    
    grant all privileges on plmsdb.* to 'plms'@'%' identified by '123456';
    
    
    
    /*
    如果想指定部分权限给一用户,可以这样来写:
    mysql>grant select,update on phplampDB.* to phplamp@localhost identified by '1234';
    //刷新系统权限表。
    mysql>flush privileges;
    */
    

  • 相关阅读:
    spring整合Quartz
    Quartz基本使用
    hibernate框架基础描述
    POI技术实现对excel的导出
    CG-CTF CRYPTO部分wp
    CG-CTF web部分wp
    快速排序算法的c++实现
    tornado当用户输入的URL无效时转入设定的页面
    sicily 4699. 简单哈希
    unbutu下Io language的解释器安装
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351796.html
Copyright © 2011-2022 走看看