I'm creating a website which has user profiles, accounts, account configurations, in-boxes, etc. much like Facebook or LinkedIn and I am wondering how to setup the mySQL tables for this.
Must I produce a table for each user for every function (profile, mailbox, etc.)?
You will need to consider all you put in a database when it comes to associations (as pointed out by other posters). Within the example you gave a person will have a someone to many relationship with such things as mail, they're going to have a face to face relationship using their account, and they'll possess a many to 1 relationship with something similar to 'locations' where lots of customers reside in one city.
When you are creating your database always request yourself which relationship type you have to build and try to never duplicate data in multiple tables when you don't have to.
Whenever you setup something similar to a customers table make certain that each row is equivalent to a person (instead of every user as being a table) which every row includes a unique auto-increment id. This user id (that's produced by MySQL) will probably be the reference that you employ in other tables to link your computer data together.
Then when you setup your mail table you may have 15 rows that contains email data, but all of individuals rows will have a area named something similar to user_id which will retain the unique id of this user in the customers table.
Get acquainted with such things as LEFT JOIN--this is the way you'll operate a single query and obtain, for instance, your user's data And every one of his email at the same time.
You would not produce a table for each user.
You'd produce a record along with a unique id for every user, after which relate that user with other tables while using ID like a foreign type in other tables.
In a nutshell yes, each function ought to be in a single table, if there's aneed to. On edit: And never a table for each user. One record in every corresponding table
The idea this handles is normalization. Consider profile and mailbox. A person only has one profile, but might have numerous messages within the mailbox. It seems sensible to achieve the mailbox as the second table with every message being recognized with a message-id and it is owner, then it's content.