Password hashes can be stored in pretty much by any field that can store a full string character set, typically a good idea to use a field that supports UTF-8 (any form, even MySQL UTF-8), so you can use VARCHAR
, or TEXT
fields to store the string, as that's all it is, is a string. It's not special.
There is a length issue that the column will need to be long enough to store the data and not Truncate it. Off the top of my head I think PHP password_hash
using PASSWORD_BCRYPT
is limited to 60 characters, but other hashing mechanisms will be longer.
ALTER TABLE <name> ADD `passwd` TEXT CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci NOT NULL ;
As a side note password
is a MySQL Keyword and while not reserved, it can make things easier to maintain and easier for your IDE to understand if you don't name the column password
.