Log in

View Full Version : Newbie Question



Transentient
10-09-2011, 10:50 PM
Hi All

looking for some information.

I am a complete beginner on MySql etc......and this maybe not the forum for this question so apologies.

I am trying to create a secure login for a website, a personal one for a learning project. My research has indicated to use a website form which sends the data to a MySQL database for validation of the credentials.

My question is does the SQL database have to reside on the website hosting server or on the machine i use to create and upload the website? If it is the later does this machine have to be switched on and connected always for validation.

The login is just for me as a personal thing and learning tool. I may extend this to include other users, registration etc later. just want a simple secure login. I understand creating the form with PHP etc....just not sure on the database location.

Thanks in advance

djr33
10-09-2011, 11:59 PM
Welcome to the forums, and this is the correct place for this type of question. In the future please provide a more descriptive title so it's easy to recognize this thread, though.


Often the website and database are hosted on the same server. That's not required, though. You will need two servers-- one for mysql and one for the website (including PHP). But those CAN be the same server, just operating both HTTP and MySQL.

The most common configuration is to run both from the same server and access it using "localhost" as the database location. Of course you can also supply a domain name or IP address for a remote server.

Both servers WILL need to be on at the same time, so if you choose to host the database remotely make sure it is on a computer that will be available whenever you need it.


Hosting a database is, very broadly speaking, like hosting a website. So I would recommend against using your home computer for at least three reasons:
1. You will always need the computer to be on.
2. It will always be running MySQL, and not only could this get in your way personally, but if you are using the computer a lot it might slow down the MySQL connection too. Best not to have one computer doing two jobs.
3. Your internet connection is probably not very fast (especially on upload), so using a professional server will make your website go faster. And in some cases your internet usage may be limited, so you might run out of access during the month (bandwidth). In some situations, this may not be a problem, but that doesn't solve (1) or (2) still. Similarly, MySQL doesn't mean you'll be transferring a lot of data, so really what you'd be worried about is response time (the delay when information is requested) not the actual transfer speed once it's going.



As I said, it's common for both to be located on a single server. In fact, if you're installing everything yourself, that's the obvious answer.
A lot of hosts these days do put MySQL on a different server (a "remote server") and that works fine too.

In the end, your "decision" may be based entirely on where your hosting service allows you to use MySQL. If you have a dedicated server and can install software, it's your choice.

If you don't have MySQL on your current host, you can probably rent a specifically MySQL server, but I would suggest changing hosts-- there are a number for about $5 per month that will give you PHP and MySQL, without any really strict limits so it won't bother you as you start.