homepage Welcome to WebmasterWorld Guest from 54.226.136.179
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
Do scripts connect to MySQL directly on the same machine,
or over the Internet?
MichaelBluejay

WebmasterWorld Senior Member 10+ Year Member



 
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.

 

whoisgregg

WebmasterWorld Senior Member whoisgregg us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
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. ;)

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4158329 posted 4:17 pm on Jun 24, 2010 (gmt 0)

Additionally, if you eliminate the database server in making your connection, it will default to localhost.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved