zoukankan      html  css  js  c++  java
  • Mysql 新建用户 并指定能访问的数据库权限

      (1)新建用户

    CREATE USER 'your_username'@'%' IDENTIFIED BY 'your_password';

    CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_password';

      % 号表示支持远程登录数据库

        localhost 可以设定为指定的主机地址,例如IP 或者 localhost ,表示只能在指定主机登录

      (2)用户授权

    grant Alter, Create, Delete, Drop, INDEX, Insert, Select, Update  on `your_db_name`.* TO 'your_username'@'%';

    // Alter, Create, Delete, Drop, INDEX, Insert, Select, Update 为具体权限操作

      

      (3)刷新MySQL的系统权限相关表,或者重启数据库

        

    flush privileges;  
    

     

       (4)撤销用户权限

    REVOKE privilege ON databasename.tablename FROM 'username'@'host';
    

      

         (5)用户删除

    drop user your_name

    DROP USER 'your_username'@'host';

    DROP USER 'your_username'@'%';

      

       

      一、启动方式

      1、使用 service 启动:service mysqld start

      2、使用 mysqld 脚本启动:/etc/inint.d/mysqld start

      3、使用 safe_mysqld 启动:safe_mysqld&

      二、停止

      1、使用 service 启动:service mysqld stop

      2、使用 mysqld 脚本启动:/etc/inint.d/mysqld stop

      3、mysqladmin shutdown

      三、重启

      1、使用 service 启动:service mysqld restart

      2、使用 mysqld 脚本启动:/etc/inint.d/mysqld restart

  • 相关阅读:
    python day04 列表增删改查
    python day03 字符串操作
    python day02 格式化输出逻辑运算
    面试题
    python基础练习题(一)
    编译安装PostgreSQL
    Python函数初识二
    Python函数初识
    笨办法学Python
    笨办法学Python
  • 原文地址:https://www.cnblogs.com/winyh/p/14605075.html
Copyright © 2011-2022 走看看