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

  • SEARCH
  • Home
  • 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 6351769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:04:14+00:00 2026-05-24T22:04:14+00:00

Django can simply connect to its own MySQL server by setting HOST and PORT

  • 0

Django can simply connect to its own MySQL server by setting HOST and PORT in settings.py as ” (empty string):

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'dbname',                   # Or path to database file if using sqlite3.
        'USER': 'root',                      # Not used with sqlite3.
        'PASSWORD': 'root',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}

My question is how to make it able to connect another database on another host? Suppose my machine is 192.168.1.33 and another machine to be connected is 192.168.1.34, both are on the same network. I’ve tried to set this as:

'HOST': '192.168.1.34',
'PORT': '3306',

and

'HOST': '192.168.1.34',
'PORT': '',

but both caused this OperationalError:

(2003, "Can't connect to MySQL server on '192.168.1.34'(10061)")

SOLUTION: credit @cdhowie

  1. Config bind-address to the host you want in /etc/mysql/my.cnf

  2. Create a new user for the host you want to give an access (if you don’t have one).

  3. Check privileges for that user (if access denied).

  • 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-24T22:04:15+00:00Added an answer on May 24, 2026 at 10:04 pm

    By default, Debian-based distros configure MySQL to bind to localhost only, which means that other hosts cannot connect to it. Fix your MySQL configuration and it will work.

    Edit /etc/mysql/my.cnf and change this line:

    bind-address = 127.0.0.1
    

    To this:

    bind-address = 0.0.0.0
    

    This will expose MySQL to all network interfaces, so make sure that you have security measures in place if this server is exposed to untrusted hosts.

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

Sidebar

Related Questions

Django 1.2 adds new allowable symbols to usernames, meaning usernames can simply be email
In PHP I can send an email simply by calling mail() . In Django,
From what I can tell, in Python and and Django, signals are simply delegated
An application that uses Flask framework, can start the built-in werkzeug development server simply
Can Django admin site select entries by a custom date range, i.e. using two
Typically in Django I can find out what queries are being run against the
The django csrf middleware can't be disabled. I've commented it out from my Middleware
I've searched SO and the Django doc and can't seem to be able to
I am sending an AJAX request to a Django view that can potentially take
Can I perform a dumpdata in Django on just a single model, rather than

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.