Search code examples
database-designdatabase-optimization

Advantages of having user authentication details stored in a separate table


I have a user table in mysql containing all user data (firstname, surname, address, etc)

But should I store the authentication details in another table (username, password) and link the two tables via a user ID?

Is there much point in this?

Is it more secure?

or does it just add extra coding?


Solution

  • Is there much point in this?

    Nope, not at all.

    Is it more secure?

    If someone can access your users table they can surely access whatever other table the passwords are on, so no.

    or does it just add extra coding?

    Pretty much. You'll have to a lot of excess JOINs to get the password info when there's really no reason to be dividing up the data in the first place.