Accessing MySQL in SSH

Feb 4, 2009

Our MySQL configuration has changed recently, so if you try to use MySQL in SSH and receive the error “Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock“, you should make sure that MySQL is connecting to the server via TCP. When using the MySQL command line client, this should be the default anyway, so if you encounter this error make sure that you don’t have a custom my.cnf file overriding the protocol setting.

If you’re trying to use Django from SSH (e.g. syncdb or the Python shell), you’ll need to change the DATABASE_HOST setting to “127.0.0.1”. This can be changed back once you’re finished working in SSH.