Django連接mysql常見錯誤


  • 1045, “Access denied for user 'root'@'localhost' (using password: YES)”
    數據庫的密碼或用戶名不對,查看settings.py

  • 1049, "Unknown database 'nav_db'"
    數據庫不存在,查看settings.py或在mysql中新建數據庫

  • RuntimeError: Model class django_openid_auth.models.Nonce doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
    在INSTALLED_APPS中卸掉一個模塊后,urls.py的urlpatterns也要卸掉對應的路由

  • 1146, "Table 'nav_db.django_session' doesn't exist"
    需要先初始化django的數據表

python manage.py makemigrations
python manage.py migrate

  • 1251, 'Client does not support authentication protocol requested by server; consider upgrading MySQL client'
    需要在mysql客戶端重置密碼
>>USE mysql; 
>>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '831015';
>>FLUSH PRIVILEGES;

  • python2.7無法安裝MySQLDB或者mysqlclient
    下載一個mysqlclient-1.4.2-cp27-cp27m-win_amd64.whl,pip install


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM