MacOS10.5にインストールしたDjangoでMAMPのMySQLを設定
3 / 12 / 2010
$ sudo easy_install MySQL-python
EnvironmentError: mysql_config not found
パスが通ってなかったっぽいので
$ PATH=$PATH:/usr/local/mysql/bin
$ export PATH
とする。気を取り直して
$ sudo easy_install MySQL-python
Finished processing dependencies for MySQL-python
出来た!
さてこっからDjangoとの連携。プロジェクトの場所に移動して
$ python manage.py syncdb
_mysql_exceptions.OperationalError: (2002, “Can’t connect to local MySQL server through socket ‘/opt/local/var/run/mysql5/mysqld.sock’ (2)”)
sockの場所ってどこよ?
MAMPのMySQLなので
$ ls /Applications/MAMP/tmp/mysql/
mysql.pid mysql.sock
ありますね。settings.pyを開いて
DATABASE_HOST = ‘/Applications/MAMP/tmp/mysql/mysql.sock’
とする。
$ python manage.py syncdb
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_siteYou just installed Django’s auth system, which means you don’t have any superusers defined.
Would you like to create one now? (yes/no): yes
出来た!
















