Django can not connect to MySQL database over ubuntu 10.04

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0















I got a simple Django 1.3.* project, i would like to run it over my localhost.
I installed all necessary modules like: python-mysqldb, rptz etc...
I have ubuntu 10.04 installed with python 2.7.2.
When i tried to start project in terminal



thor@thor:/media/SAJAT - Projects/project/simple project$ python manage.py runserver


I got the following error message:



> Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.core.management.commands.runserver.Command object at 0x1224910>>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.7/dist-packages/django/core/management/validation.py", line 102, in get_validation_errors
connection.validation.validate_field(e, opts, f)
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 338, in get_server_version
self.cursor()
File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 322, in _cursor
self.connection = Database.connect(**kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '172.17.30.101' (110)")


I have no idea where this IP address comes from 172.17.30.101' (110) because of my mysql server has been installed on my computer(localhost)



Here is my settings.py file



 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': 'dbuser', # Not used with sqlite3.
'PASSWORD': '123456', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
#'PORT': '3306', i tried with this too # Set to empty string for default. Not used with sqlite3.
#'PORT': '3360', i tried with this too # Set to empty string for default. Not used with sqlite3.
,
# 'read':
# 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
# 'NAME': 'newsonia', # Or path to database file if using sqlite3.
# 'USER': 'dbuser', # Not used with sqlite3.
# 'PASSWORD': 'dbname', # Not used with sqlite3.
# 'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
# 'PORT': '', # Set to empty string for default. Not used with sqlite3.
#



I have no idea how should be resolve this kind of errors.










share|improve this question
























  • It might be better to ask this on a Django-specific forum.

    – Faheem Mitha
    Aug 16 '14 at 9:31















0















I got a simple Django 1.3.* project, i would like to run it over my localhost.
I installed all necessary modules like: python-mysqldb, rptz etc...
I have ubuntu 10.04 installed with python 2.7.2.
When i tried to start project in terminal



thor@thor:/media/SAJAT - Projects/project/simple project$ python manage.py runserver


I got the following error message:



> Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.core.management.commands.runserver.Command object at 0x1224910>>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.7/dist-packages/django/core/management/validation.py", line 102, in get_validation_errors
connection.validation.validate_field(e, opts, f)
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 338, in get_server_version
self.cursor()
File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 322, in _cursor
self.connection = Database.connect(**kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '172.17.30.101' (110)")


I have no idea where this IP address comes from 172.17.30.101' (110) because of my mysql server has been installed on my computer(localhost)



Here is my settings.py file



 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': 'dbuser', # Not used with sqlite3.
'PASSWORD': '123456', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
#'PORT': '3306', i tried with this too # Set to empty string for default. Not used with sqlite3.
#'PORT': '3360', i tried with this too # Set to empty string for default. Not used with sqlite3.
,
# 'read':
# 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
# 'NAME': 'newsonia', # Or path to database file if using sqlite3.
# 'USER': 'dbuser', # Not used with sqlite3.
# 'PASSWORD': 'dbname', # Not used with sqlite3.
# 'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
# 'PORT': '', # Set to empty string for default. Not used with sqlite3.
#



I have no idea how should be resolve this kind of errors.










share|improve this question
























  • It might be better to ask this on a Django-specific forum.

    – Faheem Mitha
    Aug 16 '14 at 9:31













0












0








0








I got a simple Django 1.3.* project, i would like to run it over my localhost.
I installed all necessary modules like: python-mysqldb, rptz etc...
I have ubuntu 10.04 installed with python 2.7.2.
When i tried to start project in terminal



thor@thor:/media/SAJAT - Projects/project/simple project$ python manage.py runserver


I got the following error message:



> Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.core.management.commands.runserver.Command object at 0x1224910>>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.7/dist-packages/django/core/management/validation.py", line 102, in get_validation_errors
connection.validation.validate_field(e, opts, f)
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 338, in get_server_version
self.cursor()
File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 322, in _cursor
self.connection = Database.connect(**kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '172.17.30.101' (110)")


I have no idea where this IP address comes from 172.17.30.101' (110) because of my mysql server has been installed on my computer(localhost)



Here is my settings.py file



 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': 'dbuser', # Not used with sqlite3.
'PASSWORD': '123456', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
#'PORT': '3306', i tried with this too # Set to empty string for default. Not used with sqlite3.
#'PORT': '3360', i tried with this too # Set to empty string for default. Not used with sqlite3.
,
# 'read':
# 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
# 'NAME': 'newsonia', # Or path to database file if using sqlite3.
# 'USER': 'dbuser', # Not used with sqlite3.
# 'PASSWORD': 'dbname', # Not used with sqlite3.
# 'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
# 'PORT': '', # Set to empty string for default. Not used with sqlite3.
#



I have no idea how should be resolve this kind of errors.










share|improve this question
















I got a simple Django 1.3.* project, i would like to run it over my localhost.
I installed all necessary modules like: python-mysqldb, rptz etc...
I have ubuntu 10.04 installed with python 2.7.2.
When i tried to start project in terminal



thor@thor:/media/SAJAT - Projects/project/simple project$ python manage.py runserver


I got the following error message:



> Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.core.management.commands.runserver.Command object at 0x1224910>>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.7/dist-packages/django/core/management/validation.py", line 102, in get_validation_errors
connection.validation.validate_field(e, opts, f)
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 338, in get_server_version
self.cursor()
File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 322, in _cursor
self.connection = Database.connect(**kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '172.17.30.101' (110)")


I have no idea where this IP address comes from 172.17.30.101' (110) because of my mysql server has been installed on my computer(localhost)



Here is my settings.py file



 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': 'dbuser', # Not used with sqlite3.
'PASSWORD': '123456', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
#'PORT': '3306', i tried with this too # Set to empty string for default. Not used with sqlite3.
#'PORT': '3360', i tried with this too # Set to empty string for default. Not used with sqlite3.
,
# 'read':
# 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
# 'NAME': 'newsonia', # Or path to database file if using sqlite3.
# 'USER': 'dbuser', # Not used with sqlite3.
# 'PASSWORD': 'dbname', # Not used with sqlite3.
# 'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
# 'PORT': '', # Set to empty string for default. Not used with sqlite3.
#



I have no idea how should be resolve this kind of errors.







ubuntu python django






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 20 '18 at 23:44









Rui F Ribeiro

39.6k1479132




39.6k1479132










asked Aug 16 '14 at 8:57









Nagy ErvinNagy Ervin

61




61












  • It might be better to ask this on a Django-specific forum.

    – Faheem Mitha
    Aug 16 '14 at 9:31

















  • It might be better to ask this on a Django-specific forum.

    – Faheem Mitha
    Aug 16 '14 at 9:31
















It might be better to ask this on a Django-specific forum.

– Faheem Mitha
Aug 16 '14 at 9:31





It might be better to ask this on a Django-specific forum.

– Faheem Mitha
Aug 16 '14 at 9:31










1 Answer
1






active

oldest

votes


















0














First and foremost Django 1.3 has been unsupported for over a year (since 1.5's release, Feb 2013). You should consider it dangerous to leave in public-facing circumstances. Ubuntu 10.04 Server will reach that state in less than a year too... So besides your actual problem, you need to consider a infrastructure upgrade.



That your site is connecting to a random-looking reserved (it's not a legal public IP) on the standard POP3 port. I can't see any circumstance where this could happen accidentally. Something in your setup is causing this to happen.



My money's on your settings, like another definition of DATABASES that you haven't noticed. Confirm this by adding this to one of your views:



from django.conf import settings
print settings['DATABASES']


And see what comes out the other side. From there it's just finding the problem.



Failing that



  • Check that old DATABASE_* settings aren't interfering in a similar method

  • Trace the connection back through the MySQL module code. You can see what's going on in your trace. Track that back (inserting print statements if you have to) until you get to the point where your connection is being formed.





share|improve this answer
























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f150511%2fdjango-can-not-connect-to-mysql-database-over-ubuntu-10-04%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    First and foremost Django 1.3 has been unsupported for over a year (since 1.5's release, Feb 2013). You should consider it dangerous to leave in public-facing circumstances. Ubuntu 10.04 Server will reach that state in less than a year too... So besides your actual problem, you need to consider a infrastructure upgrade.



    That your site is connecting to a random-looking reserved (it's not a legal public IP) on the standard POP3 port. I can't see any circumstance where this could happen accidentally. Something in your setup is causing this to happen.



    My money's on your settings, like another definition of DATABASES that you haven't noticed. Confirm this by adding this to one of your views:



    from django.conf import settings
    print settings['DATABASES']


    And see what comes out the other side. From there it's just finding the problem.



    Failing that



    • Check that old DATABASE_* settings aren't interfering in a similar method

    • Trace the connection back through the MySQL module code. You can see what's going on in your trace. Track that back (inserting print statements if you have to) until you get to the point where your connection is being formed.





    share|improve this answer





























      0














      First and foremost Django 1.3 has been unsupported for over a year (since 1.5's release, Feb 2013). You should consider it dangerous to leave in public-facing circumstances. Ubuntu 10.04 Server will reach that state in less than a year too... So besides your actual problem, you need to consider a infrastructure upgrade.



      That your site is connecting to a random-looking reserved (it's not a legal public IP) on the standard POP3 port. I can't see any circumstance where this could happen accidentally. Something in your setup is causing this to happen.



      My money's on your settings, like another definition of DATABASES that you haven't noticed. Confirm this by adding this to one of your views:



      from django.conf import settings
      print settings['DATABASES']


      And see what comes out the other side. From there it's just finding the problem.



      Failing that



      • Check that old DATABASE_* settings aren't interfering in a similar method

      • Trace the connection back through the MySQL module code. You can see what's going on in your trace. Track that back (inserting print statements if you have to) until you get to the point where your connection is being formed.





      share|improve this answer



























        0












        0








        0







        First and foremost Django 1.3 has been unsupported for over a year (since 1.5's release, Feb 2013). You should consider it dangerous to leave in public-facing circumstances. Ubuntu 10.04 Server will reach that state in less than a year too... So besides your actual problem, you need to consider a infrastructure upgrade.



        That your site is connecting to a random-looking reserved (it's not a legal public IP) on the standard POP3 port. I can't see any circumstance where this could happen accidentally. Something in your setup is causing this to happen.



        My money's on your settings, like another definition of DATABASES that you haven't noticed. Confirm this by adding this to one of your views:



        from django.conf import settings
        print settings['DATABASES']


        And see what comes out the other side. From there it's just finding the problem.



        Failing that



        • Check that old DATABASE_* settings aren't interfering in a similar method

        • Trace the connection back through the MySQL module code. You can see what's going on in your trace. Track that back (inserting print statements if you have to) until you get to the point where your connection is being formed.





        share|improve this answer















        First and foremost Django 1.3 has been unsupported for over a year (since 1.5's release, Feb 2013). You should consider it dangerous to leave in public-facing circumstances. Ubuntu 10.04 Server will reach that state in less than a year too... So besides your actual problem, you need to consider a infrastructure upgrade.



        That your site is connecting to a random-looking reserved (it's not a legal public IP) on the standard POP3 port. I can't see any circumstance where this could happen accidentally. Something in your setup is causing this to happen.



        My money's on your settings, like another definition of DATABASES that you haven't noticed. Confirm this by adding this to one of your views:



        from django.conf import settings
        print settings['DATABASES']


        And see what comes out the other side. From there it's just finding the problem.



        Failing that



        • Check that old DATABASE_* settings aren't interfering in a similar method

        • Trace the connection back through the MySQL module code. You can see what's going on in your trace. Track that back (inserting print statements if you have to) until you get to the point where your connection is being formed.






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 16 '14 at 9:44

























        answered Aug 16 '14 at 9:38









        OliOli

        7,56563248




        7,56563248



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f150511%2fdjango-can-not-connect-to-mysql-database-over-ubuntu-10-04%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?