Jump to content

Which Collation??


shenniko

Recommended Posts

Hi guys,

Pretty new to MySQL, ive mainly been using Access DB to do most of my Database work.

I've started building a PHP site with MySQL, and im a little stuck..

Which Collation should i be using? and whats the differance? Im using phpadmin to create all my MySQL tables and at the moment my database is auto setting the Collation to "latin1_swedish_ci".

Also, on a side note,

For my user profiles, im using TINYINT.. would that mean the max number of users it would go upto would be 9999? and if so would it be better for me to change it to BIGINT? (if i expect more than 9999 users to join my site?)

Thanks in advance

Shenn
Link to comment
Share on other sites

You're fine with default collation. That is for supporting other languages that have different alphabets (like Chinese with their thousands of little drawn characters). If all your stuff is English, don't worry about it.

TINYINT has a maximum value of 128 signed or 256 unsigned. I would recommend you use SMALLINT UNSIGNED, which is about 65000. If you expect to (eventually) have over 65000 users, use MEDIUMINT UNSIGNED, for a maximum of nearly 17 million.
Link to comment
Share on other sites

UNSIGNED means that you KNOW the number will always be a positive number. Then MySQL knows that it can store from 0 to 65000 instead of from -32000 to 32000.

UNSIGNED ZEROFILL you shouldn't have to worry about, it makes it so that when you query the value, you get something with lots of leading zeros. So if you have length set to 5 and 32 is the value in the database, MySQL returns "00032".
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.