Linux: Day40 (on) user rights management and query cache

MySQL user and rights management

  Permissions categories:

    Library level

    Table level

    Field-level

    Management

    Classes

  Management:

    CREATE TEMPORARY TABLES

    CREATE USER

    FILE

    SUPER

    SHOW DATABASES

    RELOAD

    SHUTDOWN

    REPLICATION SLAVE

    REPLICATION CLIENT

    LOCK TABLES

    PROCESS

  Classes:

    FUNCTION

    PROCEDURE

    TRIGGER

 

    CREATE,ALTER,DROP,EXCUTE

  Library and table level: TABLE or DATABASE

    ALTER

    CREATE

    CREATE VIEW

    DROP

    INDEX

    SHOW VIEW

    GRANT OPTION: able to obtain permission to own a copy of a gift by other users;

  Data manipulation:

    SELECT

    INSERT

    DELETE

    UPDATE

  Field-level:

    SELECT (col1,col2,...)

    UPDATE (col1,col2,...)

    INSERT (col1,col2,...)

  All: ALL PRIVILIEGES, ALL

 

  Metadata database: mysql

    Authorization Form:

      db,host,user

      columns_priv,tables_priv,procs_priv,proxies_priv

  user account:

    ‘USERNAME'@'HOST':

      @’HOST':

        CPU name:

        IP address or Network;

        Tsuhaifu:

          %,_:172.16.%.%

    Create a user: CREATE USER

      CREATE USER 'USERNAME'@'HOST' [IDENTIFIED BY 'password']

      View authorized users get: SHOW GRANTS FOR

        SHOW GRANTS FOR 'USERNAME'@'HOST'

      Delete User: DROP USER 'USERNAME' @ 'HOST'

      change Password:

        (1) SET PASSWORD FOR

        (2) UPDATE mysql.user SET password=PASSWORD('your_password') WHERE clause;

        (3) mysqladmin password

          mysqladmin [OPTIONS] command command...

            -u,-h,-p

      Forgotten administrator password solution:

        When you start mysql process for its use: - skip-grant-tables --skip-networking

        (2) using the UPDATE command to change the administrator password

        (3) close Mysql process, the removal of the two options, restart Mysql;

    Authorization: GRANT

      GRANT priv_type[,...] ON [{table|function|procedure}] db.{table|routeine} TO 'USERNAME'@'HOST' [IDENTIFIED BY 'password']

        [REQUIRE SSL] [WITH with_option]

        with_option:
          GRANT OPTION
          | MAX_QUERIES_PER_HOUR count
          | MAX_UPDATES_PER_HOUR count
          | MAX_CONNECTIONS_PER_HOUR count
          | MAX_USER_CONNECTIONS count

      

 

    Deauthorize: REVOKE

      REVOKE priv_type [(column_list)] [, priv_type [(column_list)]] ... ON [object_type] priv_level FROM user [, user] ...

    

    Exercise: authorized users to connect the current test mysqld by any host, but shall not exceed the maximum number of queries per second, five times; while this account may not exceed three times the number of connections;

  

Query cache:

  How to determine whether a hit:

    Query by the hash value judgments: Factors to consider include the hash value

      The query itself, to query the database, the client uses protocol version, ...

      Different query on any character will cause the cache can not hit;

Guess you like

Origin www.cnblogs.com/sq5288/p/11511259.html