Error mysql en proyectos django

Imagen de diegoug
0 puntos

tengo un problema muy curioso,

Tengo dos proyectos en Django, uno si me esta funcionando bien donde por ejemplo si quiero ejecutar el migrate de south funciona bien.

pero el otro proyecto no corre la migracion y me saca este error: OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")

en mysql me estan saliendo dos errores en este orden:

$sudo /etc/init.d/mysql restart
* Stopping MySQL database server mysqld [fail]
* Starting MySQL database server mysqld [fail]

$ tail -5 /var/log/mysql/error.log
131026 15:13:51 [Note] Server socket created on IP: '127.0.0.1'.
131026 15:13:52 [Note] Event Scheduler: Loaded 0 events
131026 15:13:52 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.34-0ubuntu0.13.10.1' socket: '/tmp/mysqld.sock' port: 3306 (Ubuntu)
131026 15:17:12 mysqld_safe A mysqld process already exists

proyecto 1 $ python manage.py syncdb
Syncing...
OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")

$ mysql -h localhost -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2)

$ sudo mv /tmp/mysql.sock /tmp/mysqld.sock
[sudo] password for diegoug:
@diegoug:/home/p$ mysql -h localhost -u root -p
Enter password:
Welcome to the MySQL monitor.
mysql> exit;

proyecto 2 $ sudo python manage.py runserver
Validating models...

0 errors found
October 26, 2013 - 16:34:48
Django version 1.5.4,
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 143, in get
return self.get_query_set().get(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 398, in get
num = len(clone)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 106, in __len__
self._result_cache = list(self.iterator())
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 317, in iterator
for row in compiler.results_iter():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 775, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.7/dist-packages/johnny/cache.py", line 367, in newfun
val = original(cls, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 839, in execute_sql
cursor = self.connection.cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 324, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 406, 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)
OperationalError: (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)")

$ sudo mv /tmp/mysqld.sock /tmp/mysql.sock

proyecto2 $ sudo python manage.py runserver
Validating models...

0 errors found
October 26, 2013 - 16:37:49
Django version 1.5.4, using settings 'p.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[26/Oct/2013 16:38:17] "GET / HTTP/1.1" 200 56924