如何批量加密 MySQL 数据库中的现有密码?
我正在为客户更新一个 Web 系统,他的“帐户”表有超过 20,000 个用户,每个用户都有一个纯文本的密码字段,这意味着所有密码都没有加密。 (我知道,可怕!)无论如何,我需要知道如何获取所有这些密码并轻松加密它们(最好以批处理方式),然后将它们导入回数据库。我在搜索中找不到太多内容。我确实看到了 B-Crypt,但它看起来主要用于文件。我对此很新手,所以任何建议将不胜感激!谢谢。 :)
I am updating a web system for a client, and his 'accounts' table has over 20,000 users, each with a password field of straight text, meaning none of the passwords are encrypted. (I know, scary!) Anyway, I need to know how to take ALL of these passwords and easily encrypt them, preferably in batch style, and import them back into the db. I couldn't find much in searches. I did see B-Crypt, but that looks to be used mostly for files. I'm pretty novice at this so ANY suggestions would be greatly appreciated! Thanks. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
这是执行此操作的一种方法。
编辑
其中“table_Users”是保存密码的表,“password”是密码的列名称。
结束编辑
虽然更好的想法是使用单独的盐值对每个密码进行哈希处理,而不是加密。 (我的意见)
Here is one way to do this.
EDIT
where "table_Users" is the table where your password is held and "password" is the column name for the password.
END EDIT
Although a better idea would be to hash each password with an individual salt value rather than encrypting. (my opinion)