1

I wanna make database which has table contains username and password.

and I want to make username primary key , to prevent duplication.

when I tried to make that , For Example :

1-Admin 2-admin 3-AdMiN 4-ADMIN 5-ADMin etc ..

all these usernames aren't considered as duplicated.

how can I make these cases are considered as duplication ?

Thanks in advance

Abdelrahman Wahdan
  • 2,056
  • 4
  • 36
  • 43

3 Answers3

3

You can use a case sensitive coallation like utf8_general_cs on the table. Also your user name should not be the primary key. The PK should jsut be an auto_increment integer. If you want to make the username unique just make it a UNIQUE KEY.

prodigitalson
  • 60,050
  • 10
  • 100
  • 114
0

The opposite as you want: Altering Mysql Table column to be case sensitive

The person which have post the question says the column is case insensitive by default in MySql.

Another post here say the same.

Community
  • 1
  • 1
Aubin
  • 14,617
  • 9
  • 61
  • 84
0

The table column in mySql is case sensitive by default and not the other way.