Linux socket-to-socket tunnel (MySQL example)

socat "UNIX-LISTEN:/tmp/mysqld.temp.sock,reuseaddr,fork" EXEC:"ssh [email protected] socat STDIO UNIX-CONNECT\:/var/run/mysqld/mysqld.sock"
Won't work with password login. You must add your RSA key to the server's authorizedkeys file, or change the ssh command adding the -i option for a custom RSA key: socat "UNIX-LISTEN:/tmp/mysqld.temp.sock,reuseaddr,fork" EXEC:"ssh [email protected] -i /home/user/rsa-keys/id_rsa socat STDIO UNIX-CONNECT\:/var/run/mysqld/mysqld.sock" --- /tmp/mysqld.temp.sock will be created locally by socat, don't create it yourself. The folder it lives must be writable. Connect your MySQL client to this socket, with database and username set properly. --- In case you need to forward a remote socket to a LOCAL PORT instead, check http://www.commandlinefu.com/commands/view/9436/socat-tcp-listen5500-execssh-userremotehost-socat-stdio-unix-connectvarrunmysqldmysqld.sock

0
By: paulera
2017-07-27 11:32:19

What Others Think

hi
sattamatkatips · 151 weeks and 3 days ago
Example for coding is now here. If you are waiting to different coding then you must have to take some examples here which tell you more for essaypro review. I know all these things helping us to make our coding work perfect and we have to make our work best after taking help from here.
Brookeeyes · 30 weeks and 5 days ago
Command and all tips of the joy are filled for the enhancement of the goals. The objective of the research paper help is assured for the improvement of the goals. The struggle is difficult. The potent oil is filed for future items. The theory is explained by humans.
KennethOrozco · 30 weeks and 2 days ago
This article is massively delighting and orchestrated to research you said the right we never do the trade on the whole issues and religion in any event or gathering https://tspiglobal.com the manner in which that the assessment about them wreck the event and annihilate all fulfillment.
Katrinaields · 25 weeks and 2 days ago
This brief article will discuss the nature of a compression fracture and how to treat this diagnosis. One such way is to best spine doctor near me use a well-made brace that can help you promote the healing process. We will discuss more in this article.
PriscillaScott · 22 weeks and 3 days ago
One had the perfect traits of a boxer - quick hands, unparalleled foot speed, great reach. The ability to avoid, and later take most punches, all with the grace of a gazelle. The little caesars hot and ready other had all the fine makings of a singer: perfect pitch, vibrato, presence, incredible phrasing, a finger-snapping style. He was, in short, the voice.
ChandraHill · 21 weeks and 5 days ago
I'm constantly searching on the internet for posts that will help me. Too much is clearly to learn about this. Custom Patches I believe you created good quality items in Functions also. Keep working, congrats!
muneerahmed · 3 weeks and 3 days ago
You have done a great job. I will definitely dig it and personally recommend to my friends. keyword search I am confident they will be benefited from this site.
muneerahmed · 2 weeks and 1 day ago
Excellent article plus its information and I positively bookmark to this site because here I always get an amazing knowledge as I expect. Custom Embroidered Patches Thanks for this to share with us
muneerahmed · 1 week and 5 days ago
So luck to come across your excellent blog. Your blog brings me a great deal of fun.. digitizing embroidery service Good luck with the site.
muneerahmed · 1 week and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: