mysql - pgloader - 无法以用户“root”身份连接到“localhost”(端口 3306)的 mysql:条件 QMYND:MYSQL-UNSUPPORTED-AUTHENTICATION 已发出信号
问题描述
我正在尝试将我的 Rails 应用程序从 mysql 迁移到 postgres。由于我们已经运行了应用程序,所以我正在使用 pgloader 将 mysql 数据移动到 postgres 数据库。但是当我这样做时
pgloader mysql://root:root_password@127.0.0.1/mysql_database postgresql://postgres_user:postgres_pass@127.0.0.1/postgres_database
我收到错误 - 无法以用户“root”身份连接到“127.0.0.1”(端口 3306)的 mysql:条件 QMYND:MYSQL-UNSUPPORTED-AUTHENTICATION 已发出信号。我可以很容易地从终端登录到 mysql。提前致谢。
解决方案
The problem is that currently pgloader doesn't support caching_sha2_password
authentication plugin, which is default for MySQL 8, whereas older MySQL versions use mysql_native_password
plugin. The corresponding issue is opened on Github.
Based on this comment, the workaround here is to edit my.cnf
(if you don't know where it is, look here) and in [mysqld]
section add
default-authentication-plugin=mysql_native_password
Then restart your MySQL server and execute:
ALTER USER 'youruser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
After that the error must be gone.
推荐阅读
- angular - Protractor 中的奇怪故障问题:Jasmine 测试用例?
- yocto - 如何检测bitbake中本地文件的变化?
- c++ - API 返回智能指针的 std::optional 以明确指定指针可能为空是否有意义?
- amazon-web-services - 用于限制 EC2 实例上的读取访问的 AWS IAM 策略
- ruby-on-rails - 查询连接表rails活动记录
- python - 在 Python 中使用 **kwargs 的正确方法
- c# - 如何在 C# 中从网站获取 HTTP 响应?
- linux-kernel - 从 linux 内核中的 irq 处理程序启动 DMA 事务
- react-native - onClick 事件在 Victory Pie React-Native 上不起作用
- javascript - 如何在 angularjs 中使用 $http.post() 在 post 方法中发送带有 enctype="multipart/form-data" 的表单数据