tags:

views:

319

answers:

6

MySQL offers many ways (on Windows) to connect to it, those are:

  • Shared memory
  • Named pipes
  • TCP/IP

My question is, if MySQL will be run on the same machine of the web server, then which method is best for security and performance?

P.S. This is a one web server scenario, no web farm.

Thanks

A: 

TCP/IP in all cases.

Dev er dev
Could you provide some arguments to support this?
Aron Rotteveel
TCP/IP is neither more secure, nor faster.
Alnitak
+5  A: 

In terms of performance if both are running on the same machine then shared memory is the better option as it wont run into issues with firewall software that may be on the machine or installed at a later date.

However if in the future you need to seperate the web server and database due to upsizing, you will need to make changes to support this.

Therefore in the long run the better option is to go with TCP/IP as this will allow the servers to be seperated with the minimum of heartache.

I agree with the TCP/IP
jtyost2
A: 

Shared memory or named pipes gives less overhead than TCP/IP, however, do windows even support named pipes?

TCP/IP is the most compatible and scalable way to go on the other hand, and many connectors doesn't even support anything else afaik.

You shouldn't restrict your scenario to "same machine" or plattform "windows" if you don't have to, it's always good to have scalability in mind.

jishi
windows does support named pipes but SQL server 2005 did have a couple of foibles setting it up in that it sometimes used the wrong path for the pipe. I believe 2008 fixed most of those though.
A: 

Just use 'localhost' for now.

Seun Osewa
A: 

I'd say named pipes as it does provide significant difference than TCP/IP (tested with large dump imported).

But you might need to consider how the actual application on the web server will perform using any of these connections, because the driver might not be capable of working with named pipes for example.

I had problems with php (on windows) and named pipes so you'd need to check that part of the story as well.

vanja
A: 

For security reasons, it is clearly beneficial to disable TCP/IP-networking. I'm working on a .NET app, and I have had no problems connecting over a named pipe using the MySql connector. It works with the Mysql GUI tools as well :), and thats all I require.