我是Windows用户,并且非常熟悉django和数据库。
我当前的小组项目需要使用django和mysql。
我的队友(macOS用户)已经建立了一个django网站,而我试图通过在virtualenv上运行它来运行该网站。我尝试通过下载所有必需的软件包
输入pip install -r requirements.txt
。虽然,它下载了大多数软件包,但不允许我安装mysql == 8.0.13。我尝试了其他方法
例如pip install mysql==8.0.13
或什至在ubuntu bash上尝试。
但是,我总是收到此消息。...
(virtualenv) C:\Users\ed>pip install mysql==8.0.13
收集mysql == 8.0.13 找不到满足mysql == 8.0.13要求的版本(来自版本:0.0.1、0.0.2) 找不到mysql == 8.0.13 **的匹配发行版
因此,即使经过多次尝试,我也找不到解决方案,所以当我输入 'py manage.py runserver'或'python manage.py runserver',结果显示如下。...
(virtualenv) C:\kim....\projectsite>py manage.py runserver
System check identified no issues (0 silenced).
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x03585618>
Traceback (most recent call last):
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection
self.connect()
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\backends\base\base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\backends\mysql\base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\MySQLdb\__init__.py", line 86, in Connect
return Connection(*args, **kwargs)
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\MySQLdb\connections.py", line 204, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: ??? ??? ?? ? ????.\r\n")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\core\management\commands\runserver.py", line 120, in inner_run
self.check_migrations()
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\core\management\base.py", line 442, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\migrations\loader.py", line 49, in __init__
self.build_graph()
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\migrations\loader.py", line 212, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\migrations\recorder.py", line 61, in applied_migrations
if self.has_table():
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\migrations\recorder.py", line 44, in has_table
return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\backends\base\base.py", line 255, in cursor
return self._cursor()
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\backends\base\base.py", line 232, in _cursor
self.ensure_connection()
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection
self.connect()
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection
self.connect()
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\backends\base\base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\django\db\backends\mysql\base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\MySQLdb\__init__.py", line 86, in Connect
return Connection(*args, **kwargs)
File "C:\Users\edwardkim\Envs\shkim\lib\site-packages\MySQLdb\connections.py", line 204, in __init__
super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: ??? ??? ?? ? ????.\r\n")
我在这个问题上困扰了很长时间,甚至仍然无法运行 manage.py。请帮助我解决这个问题,并提出任何好的解决方案。感谢您的阅读。
答案 0 :(得分:1)
您将MySQL数据库与用于连接它的Python库混淆了。
pip
仅安装Python库。要安装MySQL本身,您需要从其网站https://dev.mysql.com/downloads/mysql/下载MySQL(或使用软件包管理器,例如Chocolatey。
您需要通过pip
安装的Python库是mysqlclient。