DelphiFAQ Home Search:

What is a mysql database and do I need multiple mysql databases?

 

comments9 comments. Current rating: 5 stars (5 votes). Leave comments and/ or rate it.

Question:

I am in the process of picking a web hosting company. I try to understand their feature lists. Several of them offer 1 mysql database but some offer multiple (5 or even 10) mysql databases. What is a mysql database and do I need more than one of them?

Answer:

Short answer: Yes you are very likely to need mysql some time but probably one mysql database will be enough.

Detailed answer:
mysql has become a very popular database system among web hosting companies and developers. A major reason may be that mysql is free, but it is also very very fast especially in web environments (for the advanced readers: mostly read access, no triggers or transactions used).

Now what is such a database and what can you use it for on your web site? Basically, a database is used to quickly store and later retrieve structured data. Data is stored in tables. On web sites it is used to store users with their names, passwords, preferences etc. If you are tracking links to and from your site you may want to store them in a links table. You could store all this information in text files and in the early days of the internet, this was the case. Scripts for guest books and the like would not rely on a mysql database but directly update an HTML file instead. This sort of works for a guest book with a few dozen entries but is not suitable for a message board or customer management system with potentially thousands of entries.

Typically the database is accessed by a script installed on your web server. These scripts may be written in perl or php. You can write such scripts yourself or install ready-to-go solutions which you only configure to suit your needs. Often your web hosting company will provide such scripts preinstalled.

But even if you have only one mysql database, you can install several such packages. E.g. your customer management system could be using tables in mysql with table names “customers”, “purchases”, “correspondence”.
Your advertising campaign might be using tables “adv_links”, “adv_checks” etc.
Further on you could use the mysql database to keep track of visitors that were referred from external web sites like search engines or discussion boards. You could store all your referral urls in a table “referring URLs”.

On this web site where you are reading right now (delphifaq.com) the author himself has installed 5 homegrown script solutions which store all kinds of data. For a while a standard message board system was also installed. Do you see the links on the left side to amazon.com? Yes, they are stored in a mysql table. The links in the ‘See-also’ section are stored in mysql as well.
Altogether this site accesses one single database with over 60 tables. There is no need for multiple mysql databases.

However, there is a very small chance that you want to install two packages that each want to create a table with the same name. In this moment you will have a name overlap conflict. I have never heard of such a situation but it would be possible theoretically.

Also if you want to host multiple domains and each shall have their own discussion board etc, then you will need a separate mysql database for each domain.


Content-type: text/html

Comments:

2006-10-07, 07:34:19
anonymous from Qatar  
thanks for this nice article, but i have a question. i'm not a pro in this field, and i'd like to know if i need to make the tables by myself?. or only start the instilation of the script in it'll do the rest. also is 'prefix' the same?

thank you in advance
2006-10-07, 07:34:56
candy.alman@gmail.com from Qatar  
rating
2007-07-20, 08:57:43
anonymous from Shanghai, China  
rating
Very clear response. I wish more techies were so clearly thinking and communicating!
2009-01-10, 12:00:49
cox.crc@gmail.com from United States  
rating
Ha, I always new I should look into MySQL more. That sounds like a lot of fun to get familiar with! Thanks for the great article.
2009-01-10, 12:52:43
cox.crc@gmail.com from United States  
rating
Ha, I always new I should look into MySQL more. That sounds like a lot of fun to get familiar with! Thanks for the great article.
2009-01-27, 09:08:57
anonymous from Galway, Ireland  
That's a very good answer
2009-03-16, 07:27:13
from Malaysia  
rating
Thanks. Great article !
2009-10-11, 19:58:27
Peter (Admin) from United States  
TEST
2012-03-22, 12:38:39
[hidden]  
Hi, I would like to know what is the maximum size for mysql database and how do we go about getting unlimited storage. I have a limit of 1 gig per database with my actual provider, so I wonder how we can switch writing to a new database automatically in the event it is full. Any suggestion appreciated

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: