简体   繁体   English

使用sqlalchemy在mysql上更改用户权限

[英]change user's privileges on mysql using sqlalchemy

Hi I need to create an user in mysql using sqlalchemy: I am able to check the existence of the user before creating it and create it if it does not exist but when i try to gran t all the privileges on the db I get this error 嗨,我需要使用sqlalchemy在mysql中创建用户:我能够在创建用户之前检查用户的存在,如果不存在则创建它,但是当我尝试获取db上的所有特权时,出现此错误
e TypeError: not enough arguments for format string thos are the instructions that I use:
e TypeError: not enough arguments for format string thos are the instructions that I use:
TypeError: not enough arguments for format string thos are the instructions that I use:
self.engine.execute("CREATE USER 'metmi' IDENTIFIED BY 'metmi'")` self.engine.execute(“创建用户'metmi'由'metmi'标识”)

and

`self.engine.execute("GRANT ALL PRIVILEGES ON *.* TO metmi@'\%' IDENTIFIED BY  'metmi'")`

if I use the same instruction on phpMyadmin or on the mysql prompt it works, so I am really puzzled, do not know what is wrong; 如果我在phpMyadmin或mysql提示符上使用相同的指令,那么它确实有效,因此我很困惑,不知道出什么问题了; can somebody tell me what is my error? 有人可以告诉我我的错误是什么吗? thankls in advance 预先感谢

我解决了我必须在本地主机上创建同一用户的Mysql内部过程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM