简体   繁体   English

在 MySQL 表中创建新用户?

[英]Creating new user in MySQL table?

I have a _payments database with a users table with id , username , password .我有一个带有idusernamepasswordusers表的_payments数据库。 The passwords use hash+salt.密码使用哈希+盐。 My developer is unavailable and i need to create a new user.我的开发人员不可用,我需要创建一个新用户。 What query would i run to do this?我会运行什么查询来做到这一点?

Easiest way, in a crisis: make a complete copy of one row to another, and edit the user name.最简单的方法,在危机中:将一行的完整副本复制到另一行,然后编辑用户名。

Something like就像是

insert into users (username,password) select username,password from users where user_id = [otherID]

Then然后

update users set username='newname' where id=[newid]

The new user will have the same password as the existing user.新用户将拥有与现有用户相同的密码。 If you have a way to change the password using a UI, use that.如果您有办法使用 UI 更改密码,请使用它。

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

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