鱼C论坛

 找回密码
 立即注册
查看: 1846|回复: 1

[已解决]怎么win10 MySQL8.0配置下使用mysqldump报错

[复制链接]
发表于 2020-8-26 10:07:26 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
我win10上用mysql installer安装了mysql 8.0,我在cmd中(未进入mysql界面)使用mysqldump复制数据库时报错,代码如下:
  1. D:\MYSQL Program Files\MySQL\MySQL Server 8.0\bin>mysqldump -uroot -proot --databases jack --tables images > D:/download/user.sql
  2. mysqldump: [Warning] Using a password on the command line interface can be insecure.
  3. mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
复制代码

我在网上搜索了[Warning]后的问题怎么解决,给出的答案有
  1. #第一种方法、 修改数据库配置文件
  2. #有些在/etc/my.cnf,有些是在/etc/my.conf
  3. #我们需要在[client]部分添加脚本:

  4. host=localhost
  5. user=数据库用户
  6. password='数据库密码'

  7. #第二种、 修改命令
  8. #现在就可以用上面的命令进行导出了,虽然还是有错误提示,但是是不影响导出的。
  9. #可以在上面的命令中加入了–defaults-extra-file=/etc/my.cnf

  10. /usr/local/server/mysql/bin/mysqldump  --defaults-extra-file=/etc/my.cnf     -h127.0.0.1 -uroot -proot dbname > test.sql
复制代码


但我用mysql installer安装mysql server中的etc只有mysqlrouter.conf.sample一个文件,里面的内容如下,但是并没有my.cnf文件,我是需要自己创建一个吗?
  1. # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License, version 2.0,
  5. # as published by the Free Software Foundation.
  6. #
  7. # This program is also distributed with certain software (including
  8. # but not limited to OpenSSL) that is licensed under separate terms,
  9. # as designated in a particular file or component or in included license
  10. # documentation.  The authors of MySQL hereby grant you an additional
  11. # permission to link the program and your derivative works with the
  12. # separately licensed software that they have included with MySQL.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. # GNU General Public License, version 2.0, for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # along with this program; if not, write to the Free Software
  21. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA

  22. #
  23. # MySQL Router configuration file
  24. #
  25. # Documentation is available at
  26. #    http://dev.mysql.com/doc/mysql-router/en/

  27. [DEFAULT]
  28. logging_folder = %PROGRAMDATA_FOLDER%
  29. plugin_folder = %INSTALL_FOLDER%/lib
  30. runtime_folder = %PROGRAMDATA_FOLDER%
  31. config_folder = %PROGRAMDATA_FOLDER%

  32. [logger]
  33. level = INFO

  34. # If no plugin is configured which starts a service, keepalive
  35. # will make sure MySQL Router will not immediately exit. It is
  36. # safe to remove once Router is configured.
  37. [keepalive]
  38. interval = 60
复制代码
最佳答案
2020-8-27 21:10:12
你是连接xshell远程工具执行的吧,你没有把数据库的连接权限放开给外网访问,你需要修改mysql数据库下的user表中的user=root的host为%
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-8-27 21:10:12 | 显示全部楼层    本楼为最佳答案   
你是连接xshell远程工具执行的吧,你没有把数据库的连接权限放开给外网访问,你需要修改mysql数据库下的user表中的user=root的host为%
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-19 21:26

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表