?
Solved

MySQL socket vs port

Posted on 2009-12-18
6
Medium Priority
?
719 Views
Last Modified: 2013-11-07
I am trying to write an asp.net page that pulls data from a remote database and am unable to establish a connection.  I'm not at the location but when I was I printed off their server information.  I noticed that it didn't show a setting for Port:3306.  Instead it said Socket: /var/mysql/mysql.sock.  Does this mean that I can not access it remotely?  If so, can I change a setting to do so?  Or can I create a new user on their server that can connect remotely?

0
Comment
Question by:JT_SIRO
  • 2
  • 2
  • 2
6 Comments
 
LVL 51

Accepted Solution

by:
Steve Bink earned 1000 total points
ID: 26086335
The socket can be used for local applications instead of having them connect through a local TCP/IP session.  They are not mutually exclusive, though you'll have to be sure the remote server is actually set up to use a port, and which port it is using.

Also, you will need to make sure the user you use to connect has privileges to connect from remote.  This is done through GRANT statements.  Something like this, for example, would allow the user 'dbguru' to connect from anywhere:

GRANT USAGE ON *.* TO 'dbguru'@'%' IDENTIFIED BY 'password';

To limit the user to connections from a particular host (a good idea, if you can), try this instead:

GRANT USAGE ON *.* TO 'dbguru'@'my.specific.host.com' IDENTIFIED BY 'password';

Finally, you have to make sure their network configuration allows for the incoming connection.  If they have a firewall up, they'll need to punch a hole in it for you.
0
 
LVL 14

Assisted Solution

by:profya
profya earned 1000 total points
ID: 26086363
In addition to all mentioned by routinet, you need to make sure that your host's IP address is withing their MySQL's allowed list. By default, MySQL Server accepts connections only from localhost.
0
 

Author Comment

by:JT_SIRO
ID: 26114597
Thanks for the answers guys.  So does the TCP/IP vs. socket setting apply to the entire server?  Or can I set that individually for each user?  It doesn't appear that way, in the server settings, but I don't know.

My bit concern is this - There are existing web apps that currently hit this db server via the socket (which implies that they are local, right?).  I don't want to flip a setting from socket to TCP/IP and bring down their existing apps.  That would be very bad.  But I do need to establish connectivity remotely.  Thanks -

Justin

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Expert Comment

by:Steve Bink
ID: 26116770
Again, they are not mutually exclusive.  MySQL can allow connection from both.
0
 
LVL 14

Expert Comment

by:profya
ID: 26118760
I have a similar environment, they are working together, no problems since socket settings are intact.
0
 

Author Comment

by:JT_SIRO
ID: 26120076
thanks -
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question