<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                > ### 新建一個用戶joytom,密碼設置為123321,并任意遠程主機都能訪問 | 屬性名 | 含義 | | --- | --- | | username | 登陸用戶名 | | host | 指定可訪問的 ip,如果指定所有 ip 都能訪問,將其設為通配符 % 即可。 | | password | 登陸密碼,如果密碼為空則無需密碼 | **2、創建用戶** ~~~sql mysql> CREATE USER 'joytom'@'%' IDENTIFIED BY '123321'; Query OK, 0 rows affected (0.00 sec) ~~~ 查看一下是否創建成功: ``` mysql> select user,host from user; +----------+---------------+ | user | host | +----------+---------------+ | copytest | % | | joytom | % | | test | % | | root | 127.0.0.1 | | root | ::1 | | | localhost | | root | localhost | | | vm-8-5-centos | | root | vm-8-5-centos | +----------+---------------+ 10 rows in set (0.00 sec) ``` 3、從另一臺服務器上遠程登錄一下: ``` [root@instance-lzmtqrkn ~]# mysql -h 創建用戶的服務器公網ip -P 3306 -u joytom -p123321 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 784 Server version: 5.6.49-log Source distribution Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | +--------------------+ 1 row in set (0.03 sec) ``` 查看一下數據庫,發現是沒有權限的,只能看到`information_schema`數據庫。 > ### **1、給用戶授權命令** ``` grant privileges on database.tablename to “username”@’host’; ``` privileges:用戶的操作權限,如 SELECT,INSERT,UPDATE 等,如果要授予所的權限則使用 ALL。 ``` privileges 用戶的操作權限,如 SELECT,INSERT,UPDATE 等,如果要授予所的權限則使用 ALL。 database 如果不指定數據庫,直接 *.* 即可,如果指定數據庫但不指定表名,則 database.* 即可。 username 登陸的用戶名 host 給予授權的主機 ip,例如我想讓用戶A的ip使用joytom用戶所授予的權限,但是不想讓用戶B的ip來使用joytom用戶的權限。 ``` **2、給 joytom 用戶授可查、改的權限。** ``` mysql> grant select,update on copytest.student to "joytom"@'%'; Query OK, 0 rows affected (0.00 sec) ``` **3、另一臺服務器去測試:** 發現能看到`copytest`數據庫: ``` mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | copytest | +--------------------+ 2 rows in set (0.04 sec) ``` 更多 https://learnku.com/articles/58035
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看