原地址: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
- 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>