Type of data for a column 'password'

Hello everyone,
I’m trying to find which type of data do I have to use for a password column.

ADD COLUMN psw “”“”“data type”“” VARCHAR(40) or TXT or … which type
ADD COLUMN psw_repeat

Repl link:

1 Like

You should probably use the TEXT type for storing passwords in a database I believe.
As a note, you should probably hash the passwords before storing them in an SQL DB.

I just read people use CHAR and VARCHAR
But hash and salt passwords before storing them.
any easy to understand, suggestions and links to do it in php?

Assuming you’re referring to hashing the passwords here, I found this article from Google that looks good:

I have this code to insert the password on the DB xxxxx.
I created the columns psw and psw_repeat with data type VARCHAR(100)

I read the link but still quite confusing.

            <label for="psw"><b>Password</b></label>
            <input type="password" class="cambio" id="psw" placeholder="Enter Password" name="your-psw" required>

            <label for="psw-repeat"><b>Repeat Password</b></label>
            <input type="password" class="cambio" id="psw_repeat" placeholder="Repeat Password" name="psw-repeat" required>

                <input type="checkbox" class="cambio" checked="checked" name="remember" style="margin-bottom:15px"> Remember me

            <p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>

I don’t know PHP, so I can’t really help you there, but:

Is an issue because the label is for “psw-repeat” and the field id is “psw_repeat”.

yes I realized that, I put everything as psw_repeat

1 Like