1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > mysql禁止远程用户用Root登陆 – 数据库 – 前端 pymysql 事务提交

mysql禁止远程用户用Root登陆 – 数据库 – 前端 pymysql 事务提交

时间:2023-07-05 13:43:48

相关推荐

mysql禁止远程用户用Root登陆 – 数据库 – 前端 pymysql 事务提交

你只要会操作SQL语句就行了,数据库mysql里面有个user表,查看user=”root”的记录,把host不为localhost的都删除就可以了。

一般另外一条记录的host为%

偶本打算在偶的服务器执行一下,把结果给你看,但是偶的服务器上已经没用了远程root用户,偶执行的过程如下:

E:\mysql5.0.51a\bin>mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 41

Server version: 5.0.51a-community-log MySQL Community Edition (GPL)

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

mysql> use mysql

Database changed

mysql> select host,user from user where user=”root”;

+———–+——+

host| user

+———–+——+

127.0.0.1 | root

localhost | root

+———–+——+

2 rows in set (0.02 sec)

如果执行上面的语句,你发现了远程root用户,那么你可以用下面的语句删除它:

delete from user where user=”root” and host!=”localhost”;

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。