鱼C论坛

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

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

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

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

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

x
我win10上用mysql installer安装了mysql 8.0,我在cmd中(未进入mysql界面)使用mysqldump复制数据库时报错,代码如下:
D:\MYSQL Program Files\MySQL\MySQL Server 8.0\bin>mysqldump -uroot -proot --databases jack --tables images > D:/download/user.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
我在网上搜索了[Warning]后的问题怎么解决,给出的答案有
#第一种方法、 修改数据库配置文件
#有些在/etc/my.cnf,有些是在/etc/my.conf
#我们需要在[client]部分添加脚本:

host=localhost
user=数据库用户
password='数据库密码'

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

/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文件,我是需要自己创建一个吗?
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA

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

[DEFAULT]
logging_folder = %PROGRAMDATA_FOLDER%
plugin_folder = %INSTALL_FOLDER%/lib
runtime_folder = %PROGRAMDATA_FOLDER%
config_folder = %PROGRAMDATA_FOLDER%

[logger]
level = INFO

# If no plugin is configured which starts a service, keepalive
# will make sure MySQL Router will not immediately exit. It is
# safe to remove once Router is configured.
[keepalive]
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-11-22 05:59

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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