2.homebrew 설치
$ mkdir homebrew && curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C homebrew
3.테스트
$ brew install mysql
brew의 패키지가 모여있는 Cellar 디렉토리 밑에 설치
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/mysql-5.6.13.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mysql-5.6.13.mountain_lion.bottle.tar.gz
==> /usr/local/Cellar/mysql/5.6.13/bin/mysql_install_db --verbose --user=yisang --basedir=/usr/local/Cellar/mysql/5.6.13 --d
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot
To have launchd start mysql at login:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents <--- OS 실행시 자동시작을 원할시 적용
Then to load mysql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start
==> Summary
🍺 /usr/local/Cellar/mysql/5.6.13: 9382 files, 354M
$ launchctl load /usr/local/Cellar/mysql/5.6.13/homebrew.mxcl.mysql.plist <---- 수동 실행
$ launchctl unload /usr/local/Cellar/mysql/5.6.13/homebrew.mxcl.mysql.plist <--- 수동 정지
4. MySQL-python 설치
$ sudo pip install MySQL-python
"pip's wheel support requires setuptools >= 0.8 for dist-info support. " 에러 발생시 setuptool 업그레이드
$ sudo pip install setuptools --no-use-wheel --upgrade
EnvironmentError: mysql_config not found 에러 발생시 mysql bin 경로를 환경변수에 추가
export PATH=$PATH:/usr/local/mysql/bin/
$ python
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Python/2.7/site-packages/_mysql.so
Reason: image not found
위 에러 발생시 lib 파일을 /usr/lib에 심볼릭 링크 설정
$ ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
$ python
>>> import MySQLdb
>>>
댓글 없음:
댓글 쓰기