about DelphiFAQ (14)
perl CGI (65)
Web Hosting (270)
What is a mysql database and do I need multiple mysql databases?
9 comments. Current rating: (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.
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.