pythonmysqldjangomysql5

setting up mysql on Mac


I first installed Macports so it would be easier. Then installed mysql5,mysql5-server and py26-mysql.

Everything went ok. When I typed: which mysql5 it returns `/opt/local/bin/mysql5

But when i try to enter the server: mysql5, an error is generated:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)

How do I fix it?

I eventually wish to use mysql as a backend to a django project. `


Solution

  • You need to start the server. You should be able to run:

    sudo /opt/local/share/mysql5/mysql/mysql.server start
    

    You can set it to run on boot with:

    sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
    

    There is a useful guide with other details.