I'm in the process of creating an app and I need to create a table to store login credentials. I've been searching the internet to make sure I do this correctly, but I figured it best to run this by you people before I implement my strategy. I will be running MySQL serverside.
This is what I have for my user table. I do not want to use 'user' because it is reserved. I do not want to use 'users' because it's my understanding that you don't want a plural as a table name. Is 'users' an exception?
CREATE TABLE usercredential
(
id int unsigned unique auto_increment,
username varchar(32) unique not null,
salt char(32) not null,
hash char(64) not null
);
The id is used so users can change their username without me having to go into every other table and make the appropriate change. Will setting a reference remove the need for having a unique id? Is there any reason to start the unique id at a certain number other than 1?
I will be using SHA256, so the hash length of 64 should suffice.
The questions:
- Is there a commonly accepted name for a user login table?
- Do I need to have the unique id? I plan on allowing users to change their username, so I want to account for that. Is a unique id the best way to go?
- Is there any reason to start my unique id at anything other than 1?
- Are there any other issues you see with my table? I want to make sure it is secure, but security is not my specialty and I cannot hire someone else to take care of it.
Thank you in advance.