Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1019775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:03:57+00:00 2026-05-16T11:03:57+00:00

I tried creating a SSH tunnel using ssh -L 3306:localhost:22 <hostip> Then running my

  • 0

I tried creating a SSH tunnel using

ssh -L 3306:localhost:22 <hostip>

Then running my python script to connect via localhost

conn = MySQLdb.connect(host'localhost', port=3306, user='bob', passwd='na', db='test')

However, I receive the following error

(2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")

How can I make sure I’m hitting the correct host and not just some problem with the bind?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:03:57+00:00Added an answer on May 16, 2026 at 11:03 am

    Try changing "localhost" to "127.0.0.1", it should work as you expect. This behavior is detailed in the manual:

    UNIX sockets and named pipes don’t
    work over a network, so if you specify
    a host other than localhost, TCP will
    be used, and you can specify an odd
    port if you need to (the default port
    is 3306):

    db=_mysql.connect(host="outhouse", port=3307, passwd="moonpie", db="thangs")

    If you really had to, you could
    connect to the local host with TCP by
    specifying the full host name, or
    127.0.0.1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 528k
  • Answers 528k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Don't know about Visual Studio but there are some FireFox… May 16, 2026 at 10:57 pm
  • Editorial Team
    Editorial Team added an answer MATLAB Good for beginners Good for interactive sessions Python (with… May 16, 2026 at 10:57 pm
  • Editorial Team
    Editorial Team added an answer libandroid_runtime.so is in fact one of the Android system libraries,… May 16, 2026 at 10:57 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a multi part question for a php script file. I am creating
I tried creating a model called class (as in a graduating class of students),
I tried creating one, but the BackgroundWorker in Window1 couldn't access the ProgressBar in
Just tried creating a data connection to a SQL 2000 database in VS2010's Server
I tried creating a disembodied DOM element with jQuery (I avoid ever touching the
I tried creating a test plan as explained here . But the only problem
I tried creating a DB migration in Rails that looked something like this: ruby
I have tried creating a syntax highlighter for a custom file definition. I get
I have tried creating a named pipe but getting GLE 5 (access denied Error)
When I build my project (any project, really - I tried creating a new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.