7

Without any reason after I have closed terminal window without exiting and stoping server, the next time I run any command like python manage.py migrate/runserver/makemigrations I am getting the following traceback.I can't really understand what is wrong now?

EDIT:Also on 'mysql' command to enter into its interface 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'

EDIT2: I suppose it might be caused by MAMP which is also installed on my MAC

EDIT3: After I'v deleted MAMP. Not sure whether is was directly connected. Can't enter to mysql shell as well.

django.db.utils.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: NO)")

EDIT4!!:
I am using terminal on mac, so I applied this command sudo /usr/local/mysql/support-files/mysql.server start and got back

ERROR! MySQL server process #1180 is not running! Starting MySQL..... ......... ......... 

after trying to start server

ERROR! The server quit without updating PID file (/usr/local/mysql/data/MacBook-Air-Vitalij.local.pid).

restart command :

ERROR! MySQL server PID file could not be found!

EDIT5: following the recommendation from answer I tried change max_connections, but unsuccessfully :

mysql --help | grep "Default options" -A 1 
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 

I tried all paths, but it's absent. And I can't find this file manually, I'v fund out that there is no my.cnf in MySQL for Mac. Also tried to delete MySQL and reinstall it - didn't help as well.

open -a Finder etc/mysql/my.cnf
The file /Users/TheKotik/djboy/etc/mysql/my.cnf does not exist.

enter image description hereenter image description here

2 Answers2

2

consider increasing max_connections and restart mysql.

sudo /usr/local/mysql/support-files/mysql.server restart

For some reason the connection was not closed correctly when closing the terminal. Increasing max_connections will not cure it completely, but the hanging connection will eventually time-out.

Alex
  • 5,759
  • 1
  • 32
  • 47
  • @ixer how can I change max_connection if I have no access to mysql commands either? –  Nov 11 '16 at 23:36
  • 1
    it is a setting, usually in `/etc/mysql/my.cnf` or similar location. – Alex Nov 12 '16 at 00:08
  • 1
    @Vinand, I dont have a mac, but there are a lot of answers to that here http://stackoverflow.com/questions/10757169/mysql-my-cnf-location-on-os-x – Alex Nov 14 '16 at 17:31
0

Have you tried to restart your mysql process?. This can be useful when the mysql process is not shutdown correctly.

mysql.server restart 
Benjy Malca
  • 597
  • 1
  • 9
  • 21