I'll elaborate. On a webserver, you'll have some type of script - php or .net or whatever. You will write the script to talk to a 'database server'. The database server (mysql or ms sql) is a distinct program that normally runs on the webserver. The database server program actually handles the storage and access of the data, which is as noted normally stored on the same machine.
So you would write a program that says "here you go database server, here's some data, please store it." or "go look in the database and give me every record that looks like this".