MYSQL删除匿名用户的方法_MySQL
程序员文章站
2022-06-01 10:06:40
...
bitsCN.com
删除匿名用户 在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.20Type '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 |+------+----------------------------+ 作者 亦梦亦真 bitsCN.com
删除匿名用户 在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.20Type '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 |+------+----------------------------+ 作者 亦梦亦真 bitsCN.com
推荐阅读
-
MySql中表单输入数据出现中文乱码的解决方法
-
使用MySQL的yum源安装MySQL5.7数据库的方法
-
MYSQL不能从远程连接的一个解决方法(s not allowed to connect to this MySQL server)
-
mysql提示[Warning] Invalid (old?) table or database name问题的解决方法
-
mysql中为用户设置密码的多种方法
-
linux下mysql链接被防火墙阻止的解决方法
-
mysql命令行下用户管理方法分享
-
浅谈mysql中多表不关联查询的实现方法
-
xampp修改mysql默认密码的方法
-
ubuntu linux下使用Qt连接MySQL数据库的方法