情况是这样的,我们有一台数据库服务器,想在上面建两个数据库,一个开放给外包团队,另一个不想让外包团队访问,因为有保密数据。请问在mysql里能实现这个功能吗?要怎么设呢?mysql 数据库外包

解决方案 »

  1.   

    grant all on 开放数据库 to '外包数据库用户' identified by '外包用户数据库密码';
      

  2.   

    分别grant就行了,分成不同的用户。
      

  3.   

    分别给两个库授权不同用户就可以了grant
      

  4.   

    当然能啊。grant命令,最好的办法就是查看MySQL的帮助,? grant或者help grant.
      

  5.   

    mysql> ? grant
    Name: 'GRANT'
    Description:
    Syntax:
    GRANT
        priv_type [(column_list)]
          [, priv_type [(column_list)]] ...
        ON [object_type] priv_level
        TO user_specification [, user_specification] ...
        [REQUIRE {NONE | ssl_option [[AND] ssl_option] ...}]
        [WITH with_option ...]GRANT PROXY ON user_specification
        TO user_specification [, user_specification] ...
        [WITH GRANT OPTION]object_type:
        TABLE
      | FUNCTION
      | PROCEDUREpriv_level:
        *
      | *.*
      | db_name.*
      | db_name.tbl_name
      | tbl_name
      | db_name.routine_nameuser_specification:
        user
        [
            IDENTIFIED BY [PASSWORD] 'password'
          | IDENTIFIED WITH auth_plugin [AS 'auth_string']
        ]ssl_option:
        SSL
      | X509
      | CIPHER 'cipher'
      | ISSUER 'issuer'
      | SUBJECT 'subject'with_option:
        GRANT OPTION
      | MAX_QUERIES_PER_HOUR count
      | MAX_UPDATES_PER_HOUR count
      | MAX_CONNECTIONS_PER_HOUR count
      | MAX_USER_CONNECTIONS countThe GRANT statement grants privileges to MySQL user accounts. GRANT
    also serves to specify other account characteristics such as use of
    secure connections and limits on access to server resources. To use
    GRANT, you must have the GRANT OPTION privilege, and you must have the
    privileges that you are granting.Normally, a database administrator first uses CREATE USER to create an
    account, then GRANT to define its privileges and characteristics. For
    example:CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass'
    GRANT ALL ON db1.* TO 'jeffrey'@'localhost'
    GRANT SELECT ON db2.invoice TO 'jeffrey'@'localhost'
    GRANT USAGE ON *.* TO 'jeffrey'@'localhost' WITH MAX_QUERIES_PER_HOUR 90However, if an account named in a GRANT statement does not already
    exist, GRANT may create it under the conditions described later in the
    discussion of the NO_AUTO_CREATE_USER SQL mode.The REVOKE statement is related to GRANT and enables administrators to
    remove account privileges. See [HELP REVOKE].When successfully executed from the mysql program, GRANT responds with
    Query OK, 0 rows affected. To determine what privileges result from the
    operation, use SHOW GRANTS. See [HELP SHOW GRANTS].URL: http://dev.mysql.com/doc/refman/5.5/en/grant.html
    mysql>