zoukankan      html  css  js  c++  java
  • MySQL用户操作勒

    账户的创建大概分为:

     在MySQL上创建用户:

    MariaDB [(none)]> create user first@"localhost" identified by "123456";
    Query OK, 0 rows affected (0.001 sec)
    
    MariaDB [(none)]> flush privileges;
    Query OK, 0 rows affected (0.000 sec)

      在MySQL上删除用户:

    MariaDB [(none)]> Delete FROM mysql.user Where User='first' and Host='localhost';
    Query OK, 1 row affected (0.000 sec)
    MariaDB [(none)]> flush privileges;
    Query OK, 0 rows affected (0.000 sec)

    查看所有用户和对应的信息

    MariaDB [(none)]> select user,host,password from mysql.user;
    +----------+-----------+-------------------------------------------+
    | user     | host      | password                                  |
    +----------+-----------+-------------------------------------------+
    | root     | localhost | *E6CC90B878B948C35E92B003C792C46C58C4AF40 |
    | root     | 127.0.0.1 | *E6CC90B878B948C35E92B003C792C46C58C4AF40 |
    | root     | ::1       | *E6CC90B878B948C35E92B003C792C46C58C4AF40 |
    | marshall | %         | *E6CC90B878B948C35E92B003C792C46C58C4AF40 |
    +----------+-----------+-------------------------------------------+
    4 rows in set (0.000 sec)

     默认添加的用户是没有权限的,给用户添加权限:

    权限:

    all privileges:所有权限。

    select:  读取权限。

    delete:  删除权限。

    update: 更新权限。

    create:  创建权限。

    drop:     删除数据库、数据表权限。

    给用户修改密码

    如果是root类型用户修改其他用户:

    MariaDB [(none)]> ~~~
    MariaDB [(none)]> update mysql.user set password=("123456") where user="marshall" and host="%";
    Query OK, 0 rows affected (0.000 sec)
    Rows matched: 1  Changed: 0  Warnings: 0
    
    MariaDB [(none)]> flush privileges;
    Query OK, 0 rows affected (0.000 sec)

    当前用户修改密码

    MariaDB [(none)]> set password = password("1");
    Query OK, 0 rows affected (0.000 sec)

  • 相关阅读:
    From MSI to WiX, Part 2
    From MSI to WiX, Part 1
    WIX Custom Action (immediate, deffered, rollback)
    SVN: revert all command
    HowTo: SVN undo add without reverting local changes
    “Assign Random Colors” is not working in 3ds Max 2015
    CruiseControl.NET : svnrevisionlabeller
    JSON parser error with double quotes
    How to: Extract files from a compiled setup.exe created by Inno setup
    虚拟账号ftp服务器
  • 原文地址:https://www.cnblogs.com/5444de/p/12509157.html
Copyright © 2011-2022 走看看