需要借助模块 mysqlclient -------从cmd中,进入mysql
mysqlclient安装
pip install mysqlclient
数据库给某个用户赋予权限
# 查看当前数据库有哪些用户select user,host,password from mysql.user;# 创建luffy用户# 创建一个用户叫luffy,密码是:Luffy123?,可以本地链接,对luffy库所有表有权限grant all privileges on luffy.* to 'luffy'@'localhost' identified by 'Luffy123?';# 创建一个用户叫luffy,密码是:Luffy123?,可以远程地链接,对luffy库所有表有权限grant all privileges on luffy.* to 'luffy'@'%' identified by 'Luffy123?';