0

I am getting an error when I am trying to do a python manage.py syncdb.

The error is as shown below

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 231, in execute
    self.validate()
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 266, in validate
    num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.6/site-packages/django/core/management/validation.py", line 103, in get_validation_errors
    connection.validation.validate_field(e, opts, f)
  File "/Library/Python/2.6/site-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
    db_version = self.connection.get_server_version()
  File "/Library/Python/2.6/site-packages/django/db/backends/mysql/base.py", line 411, in get_server_version
    self.cursor()
  File "/Library/Python/2.6/site-packages/django/db/backends/__init__.py", line 306, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/Library/Python/2.6/site-packages/django/db/backends/mysql/base.py", line 387, in _cursor
    self.connection = Database.connect(**kwargs)
  File "/Library/Python/2.6/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/MySQLdb/connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)")

Any idea what could be the reason?

3
  • @AshwiniChaudhary MAC OS Snow Leopard Commented Jul 28, 2013 at 10:10
  • stackoverflow.com/questions/1136808/… Commented Jul 28, 2013 at 10:11
  • 2
    Your server might not be started. check if it's up with ps aux | grep mysql Commented Jul 28, 2013 at 10:40

2 Answers 2

1

Read your debug messages more careful. Error is "Can't connect to local MySQL server through socket". U should check your connection params at settings.py

Sign up to request clarification or add additional context in comments.

Comments

0

The default path to MySQL socket doesn't work on MacOS X.

This SO question provides a good answer to that problem, along with some handy links for further reading.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.