Msg#: 4158329 posted 12:17 pm on Jun 24, 2010 (gmt 0)
I've used MySQL for years but never really gave any thought to how exactly my Perl scripts establish their connection to the MySQL server. Do my scripts connect to the MySQL server locally on the same machine, or do the scripts find the MySQL server over the Internet? I'm assuming the former, for simplicity and performance, but I think there's a small chance it's the latter so that remote clients could also have the ability to access the server, and because my MySQL server hostnames are in the form of "mysql.example.com", which suggests accessing via the Internet.
I suppose these aren't mutually exclusive -- my scripts could connect directly when they could, and remote clients could connect over the Internet.
One reason I'm wondering is that I've just learned about SQlite, which runs entirely via an include or module directly inside a script. (It doesn't require a database server.) If my MySQL scripts are being served over the Internet, then SQLite would have an advantage for web apps, since the database results would be served locally rather than having to wait for the Internet.
Msg#: 4158329 posted 4:12 pm on Jun 24, 2010 (gmt 0)
MySQL can connect locally (typically by using a server of "localhost") or remotely. I have a web app now that in some cases connects to three different MySQL instances: one local and two separate remote servers.
If your database is local but you are configured to use a subdomain of your own domain then you probably want to change that to be localhost to eliminate any additional time your server may spend looking for itself on the internet. ;)