Questions tagged «user-management»

2
mysql创建用户(如果不存在)
我有一个查询来检查mysql用户列表以创建新用户。 IF (SELECT EXISTS(SELECT 1 FROM `mysql`.`user` WHERE `user` = '{{ title }}')) = 0 THEN CREATE USER '{{ title }}'@'localhost' IDENTIFIED BY '{{ password }}' END IF; 但是我得到这个错误: ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your …

4
如何检查postgres用户是否存在?
createuser允许在PostgreSQL中创建用户(ROLE)。有没有一种简单的方法来检查该用户(名称)是否已经存在?否则,createuser会返回错误: createuser: creation of new role failed: ERROR: role "USR_NAME" already exists 更新:该解决方案应该可以从Shell上执行,因此在脚本内部自动化更容易。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.