zoukankan      html  css  js  c++  java
  • 删除匿名用户

     删除匿名用户

    在MySQL刚刚被安装后,存在用户名、密码为空的用户。这使得数据库服务器有无需密码被登录的可能性。为消除隐患,将匿名用户删除。

    [root@sample ~]# mysql -u root -p  ← 通过密码用root登录
    Enter password:  ← 在这里输入密码

    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 7 to server version: 4.1.20

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    mysql> select user,host from mysql.user;  ← 查看用户信息
    +------+----------------------------+
    | user | host         |
    +------+----------------------------+
    |   | localhost       |
    | root | localhost       |
    |   | sample.centospub.com |
    | root | sample.centospub.com  |
    +------+----------------------------+
    4 rows in set (0.02 sec)

    mysql> delete from mysql.user where user='';  ← 删除匿名用户
    Query OK, 2 rows affected (0.17 sec)

    mysql> select user,host from mysql.user;  ← 查看用户信息
    +------+----------------------------+
    | user | host         |
    +------+----------------------------+
    | root | localhost      |
    | root | sample.centospub.com |
    +------+----------------------------+
    2 rows in set (0.00 sec)

    mysql> exit  ← 退出MySQL服务器
    Bye

  • 相关阅读:
    Docker安装MySQL&Redis
    使用VirtualBox+Vagrant快速搭建Linux虚拟机环境
    Java集合工具类的一些坑,Arrays.asList()、Collection.toArray()...
    1.docker常用命令
    4. 带有延迟时间的Queue(DelayQueue)
    3. 基于优先级的Queue(PriorityBlockingQueue)
    2. 常见的Queue
    1. 模拟Queue
    14. 线程调度
    13. 线程池
  • 原文地址:https://www.cnblogs.com/panzulong/p/2548966.html
Copyright © 2011-2022 走看看