• <bdo id='JU0wg'></bdo><ul id='JU0wg'></ul>

      <small id='JU0wg'></small><noframes id='JU0wg'>

      <tfoot id='JU0wg'></tfoot>
      <i id='JU0wg'><tr id='JU0wg'><dt id='JU0wg'><q id='JU0wg'><span id='JU0wg'><b id='JU0wg'><form id='JU0wg'><ins id='JU0wg'></ins><ul id='JU0wg'></ul><sub id='JU0wg'></sub></form><legend id='JU0wg'></legend><bdo id='JU0wg'><pre id='JU0wg'><center id='JU0wg'></center></pre></bdo></b><th id='JU0wg'></th></span></q></dt></tr></i><div id='JU0wg'><tfoot id='JU0wg'></tfoot><dl id='JU0wg'><fieldset id='JU0wg'></fieldset></dl></div>

      1. <legend id='JU0wg'><style id='JU0wg'><dir id='JU0wg'><q id='JU0wg'></q></dir></style></legend>

        django.db.utils.OperationalError: (1045, Access denied for u

        时间:2023-07-06

      2. <tfoot id='pzixi'></tfoot>
        <i id='pzixi'><tr id='pzixi'><dt id='pzixi'><q id='pzixi'><span id='pzixi'><b id='pzixi'><form id='pzixi'><ins id='pzixi'></ins><ul id='pzixi'></ul><sub id='pzixi'></sub></form><legend id='pzixi'></legend><bdo id='pzixi'><pre id='pzixi'><center id='pzixi'></center></pre></bdo></b><th id='pzixi'></th></span></q></dt></tr></i><div id='pzixi'><tfoot id='pzixi'></tfoot><dl id='pzixi'><fieldset id='pzixi'></fieldset></dl></div>

          <small id='pzixi'></small><noframes id='pzixi'>

          • <bdo id='pzixi'></bdo><ul id='pzixi'></ul>
            • <legend id='pzixi'><style id='pzixi'><dir id='pzixi'><q id='pzixi'></q></dir></style></legend>
                <tbody id='pzixi'></tbody>

                • 本文介绍了django.db.utils.OperationalError: (1045, Access denied for user '&lt;user&gt;'@'localhost'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我无法让我的 Django 项目正确加载我的数据库.它抛出这个错误.

                  I can't get my Django project to load my database correctly. It throws this error.

                  我正在使用 Django 运行 MariaDB,并且我卸载了所有 MySQL

                  I'm running MariaDB with Django, and I uninstalled all MySQL

                  我通过运行添加了用户:

                  I added the user by running:

                  create database foo_db;
                  create user foo_user identified by 'foo_password';
                  grant all on foo_db.* to 'foo_user'@'%';
                  flush privileges;
                  

                  按照这篇文章的建议.

                  当我尝试运行 ./manage.py runserver

                  django.db.utils.OperationalError: (1045, "Access denied for user '<user>'@'localhost' (using password: YES)")
                  

                  我已运行创建用户"命令并创建了用户以匹配我的设置脚本,该脚本的默认设置为:

                  I have run the 'create user' command and created the user to match my setup script, which has the default set as:

                          'ENGINE': 'django.contrib.gis.db.backends.mysql',
                          'NAME': 'company_production',
                          'USER': 'companydev',
                          'PASSWORD': 'companydevpass',
                          'HOST': 'localhost',
                          'PORT': '',
                          'ATOMIC_REQUESTS': True
                  

                  我已经尝试了在这里找到的与它引发的错误相关的所有内容,但没有任何效果.

                  I have tried everything I've been able to find on here related to the error its thrown, but nothing has been working.

                  我正在运行 Mac OSX 10.11.1 El Capitan 和 MariaDB 版本 10.1.8,如果这完全相关的话.

                  I'm running Mac OSX 10.11.1 El Capitan and MariaDB version 10.1.8 if that's relevant at all.

                  推荐答案

                  这是我用来为 Django 项目重新创建 MySQL 数据库的方法:

                  This is what I use to re-create MySQL databases for Django projects:

                  tmp="/tmp/mysql-tools.sh.tmp"
                  
                  setup-db ( ) {
                      cat <<EOF > $tmp
                  DROP DATABASE $DB;
                  CREATE DATABASE $DB;
                  GRANT USAGE on *.* to '${DB_USER}'@'localhost' IDENTIFIED BY '${DB_PASS}';
                  GRANT ALL PRIVILEGES ON ${DB}.* to '${DB_USER}'@'localhost';
                  EOF
                      cat $tmp
                      mysql -f -u ${MYSQL_ROOTUSR} -p${MYSQL_ROOTPWD} < $tmp
                      rm $tmp
                  }
                  

                  警告:这会掉落并重新创建!

                  Warning: this drops and re-creates!

                  地点:

                  • DB:数据库名称
                  • DB_USER:django 数据库用户
                  • DB_PASS:Django 数据库用户的 mysql 连接密码
                  • MYSQL_ROOTUSR:mysql root 用户(必须有创建数据库的权限)
                  • MYSQL_ROOTPWD:mysql root 密码

                  导出环境中的那些

                  这篇关于django.db.utils.OperationalError: (1045, Access denied for user '&lt;user&gt;'@'localhost'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:SQL并发事务忽略彼此的锁???死锁 [InnoDB, Python] 下一篇:XHR 请求 URL 在尝试解析其内容时说不存在

                  相关文章

                      <bdo id='sYlki'></bdo><ul id='sYlki'></ul>
                    <i id='sYlki'><tr id='sYlki'><dt id='sYlki'><q id='sYlki'><span id='sYlki'><b id='sYlki'><form id='sYlki'><ins id='sYlki'></ins><ul id='sYlki'></ul><sub id='sYlki'></sub></form><legend id='sYlki'></legend><bdo id='sYlki'><pre id='sYlki'><center id='sYlki'></center></pre></bdo></b><th id='sYlki'></th></span></q></dt></tr></i><div id='sYlki'><tfoot id='sYlki'></tfoot><dl id='sYlki'><fieldset id='sYlki'></fieldset></dl></div>
                  1. <legend id='sYlki'><style id='sYlki'><dir id='sYlki'><q id='sYlki'></q></dir></style></legend>

                    <small id='sYlki'></small><noframes id='sYlki'>

                  2. <tfoot id='sYlki'></tfoot>