<p>我还努力使MySQL与Django 1.6和Python 3.3一起工作;唯一有效的方法是切换到PyMySQL。看我在那上面的帖子<a href="https://github.com/PyMySQL/PyMySQL/"><strong>here</strong></a></p>
<p><strong>在下面添加答案<br/></strong></p>
<p>我的环境:OSX 10.9、Python3.3.3、Django 1.6.1、PyMySQL0.6.1、Windows上的MySQLServer5.5</p>
<p>如何使其工作:<br/></p>
<ol>
<li><p>安装PyMySQL版本0.6.1(<a href="https://github.com/PyMySQL/PyMySQL/">https://github.com/PyMySQL/PyMySQL/</a>):您可以使用pip(即:<code>pip install PyMySQL</code>)或手动下载包来安装它;他们的网站上有一个很好的文档说明了如何安装。</p></li>
<li><p>打开Django应用程序<strong>\uu init\uuu.py</strong>并粘贴以下行:</p>
<pre><code>import pymysql
pymysql.install_as_MySQLdb()
</code></pre></li>
<li><p>现在,打开<strong>settings.py</strong>并确保数据库属性如下所示:</p>
<pre><code>DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mydb',
'USER': 'dbuser',
'PASSWORD': 'dbpassword',
'HOST': 'dbhost',
'PORT': '3306'
}
}
</code></pre></li>
<li><p>就这样,您应该能够执行<code>python manage.py syncdb</code>来初始化MySQL数据库;请参见下面的示例输出:</p>
<pre><code>Creating tables ...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
...
...
Creating table socialaccount_socialtoken
You just installed Django's auth system, which means you don't have any superusers defined.
...
</code></pre></li>
</ol>