標籤:blog http os io strong 檔案 資料 for
原地址:http://blog.csdn.net/gamesofsailing/article/details/21465327
在成功安裝python-mysql後,開始配置django的mysql串連配置
開啟django項目下的setting.py檔案,將DATABASES改成下面這樣
DATABASES = {
‘default‘: {
‘ENGINE‘:‘django.db.backends.mysql‘,
‘NAME‘:‘mysite‘,
‘USER‘:‘root‘,
‘PASSWORD‘:‘‘,
‘HOST‘:‘127.0.0.1‘,
‘PORT‘:‘3306‘,
}
}
最後運行:
python mange.py dbshell
成功進入mysql shell
[plain] view plaincopy
- mylittlefishdeMacBook-Air:mysite mylittlefish$ python manage.py dbshell
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 5
- Server version: 5.6.16 MySQL Community Server (GPL)
-
- Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
-
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
-
- Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
-
- mysql>