python - Missing mysql.sock; yielding OperationalError: (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)") -


First of all, I swear that I've seen every single question that references this error, almost every solution that Provides someone, it varies, and does not understand systemic reasons for any error. What I need to face on this web, and this common problem, many people are needed, there is an explanation of what is actually going wrong.

Actually, when I try to run:

  Open from Dragon Management django.db import connection cursor = connection.cursor ()   

Django 1.4 and python 2.7.3, I get the following error: OperationCenter: (2002, "Can not connect via socket to local MySQL server '/tmp/mysql.sock' ( 2) ")

I believe that my settings .py file is correct. And everything that I should have established was established. Here settings.py:

  database = {'default': {'ENGINE': 'django.db.backends.mysql', # add 'postgresql_psycopg2', 'postgresql', 'Mysql ',' 'Username', 'sqlite3' or 'oracle' 'NAME': 'database_name.mwb', # or if the path of database file is using 'sqlite3' 'user', 'not used with sqlite3' password ':' 'Pass', 'HOST' used with # sqlite3: '/tmp/mysql.sock', set to empty string for # local host. 'Port' not used with Sqlite3: Set to empty string for # default, not used with Sqlite3}}   

sign on the web to answer After suffering from weeks of suffering, with every one on stack overflow, I came to the conclusion that the real problem I am experiencing is that mysql.sock is not a file on my computer, even if mysql So, the real question is that I am How do you get? The answer can be embarrassing simple.

When I run:

  cd / asso search -name ". Sock"   

I could not find anything. And yes, I installed mysql 5.25 on my Mac OSX lion. It is definitely installed:

  sudo launchctl load -w / library / LaunchDaemons / com.mysql.mysql.plist com.mysql.mysqld: already loaded   

However, it is running:

  mysql   

yield:

  -bash: Mysql: Command not found   

After a long time, I found this bug: .. So what's the solution ??

Full disclosure: I am just a programmer, I do not know anything about computers, therefore, I do not know anything about my SECL, database or sockets. I think there will be a need for this question, which really helps to fix the computer. As it seems, though, it seems obvious now, to prepare this error, it took a long time to get it from fault socket; 99% of the people on the web are not coming in this way with this error.

You have the MySQL client installed, but mysql-server does not handle the connection to the client. You need to install the MySQL server and run it.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -