【现象说明】

C/S程序远程訪问正常,本地訪问报下面异常

MySql.Data.MySqlClient.MySqlException (0x80004005): Authentication to host 'localhost' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'@'localhost' (using password: YES) ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Access denied for user 'root'@'localhost' (using password: YES)

配置文件例如以下:

<add name="RemoteConnString" connectionString="Database='mealbooker';Data Source='localhost';User Id='root';Password='123456';charset='gb2312';pooling=true" providerName="MySql.Data.MySqlClient"/>

【分析】

权限问题吧,查看下mysql数据库中的user表

发现localhost以下值为空,于是connection string中的localhost 改为 127.0.0.1。測试通过~~~

【解决】

配置文件里改为localhost,訪问数据库正常;同一时候mysql command line工具输入password后一闪而过问题同一时候解决。

重新启动之后又訪问不了,继续上面的思路改动:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc2hpbmV5Y2g=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

另,mysql command line工具一闪而过,方法參见这里

还有一个权限相关问题:

Error Code: 1370 execute command denied to user 'root'@'localhost' for routine

使用grant execute on procedure/function dbname.fname TO 'root'@'localhost';

还有一password相关问题(调试机放几天后就没法远程訪问了,rootpassword被修改,不明原因):

Authentication to host '10.10.123.6' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'@'10.10.123.5' (using password: YES) ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Access denied for user
'root'@'10.10.123.5' (using password: YES)

改动password语句例如以下:

然后还要给远程用户非配权限

grant all privileges on *.* to 'root'@'%' with
grant option;

mysql Access denied for user &#39;root&#39;@&#39;localhost&#39; (using password: YES)的更多相关文章

  1. mysql Access denied for user root@localhost错误解决方法总结(转)

    mysql Access denied for user root@localhost错误解决方法总结(转) mysql Access denied for user \'root\'@\'local ...

  2. MySQL Access denied for user root@localhost 解决方法

    今天把本地开发的项目(ThinkPHP 3.2.3)移到虚拟机上(CentOS 6.6,LNMP 1.2,MySQL 5.6.23),配置好 MySQL 之后访问首页,出现: 此时 MySQL 的用户 ...

  3. 解决mysql“Access denied for user 'root'@'localhost'”

    解决mysql“Access denied for user 'root'@'localhost'” 分类: linux 2011-01-14 00:23 147547人阅读 评论(3) 收藏 举报 ...

  4. mysql Access denied for user \'root\'@\'localhost\'”解决办法总结,下面我们对常见的出现的一些错误代码进行分析并给出解决办法,有需要的朋友可参考一下。

    mysql Access denied for user \'root\'@\'localhost\'”解决办法总结,下面我们对常见的出现的一些错误代码进行分析并给出解决办法,有需要的朋友可参考一下. ...

  5. MySql access denied for user错误

    MySql access denied for user错误 | 浏览:2812 | 更新:2014-11-27 11:16 MySql access denied for user错误 方法/步骤 ...

  6. 我用工具怎么连接不上mysql数据库的? MySql access denied for user错误

    MySql access denied for user错误 方法/步骤   MySql远程连接时的"access denied for user **@**"错误,搞的我很头大, ...

  7. MySql Access denied for user 'root'@'localhost' (using password:YES) 解决方案

    关于昨天下午说的MySQL服务无法启动的问题,解决之后没有进入数据库,就直接关闭了电脑. 今早打开电脑,开始-运行 输入"mysql -uroot -pmyadmin"后出现以下错 ...

  8. mysql Access denied for user root @localhost (using password:YES)错误

    C:\AppServ\MySQL> mysql -u root -p Enter password:  ERROR 1045 (28000): Access denied for user 'r ...

  9. mysql Access denied for user root@localhost错误解决方法总结

    原文:http://www.111cn.net/database/mysql/44142.htm Access denied for user 'root'@'localhost' (using pa ...

随机推荐

  1. [SCOI 2010] 股票交易

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=1855 [算法] 单调队列优化动态规划 [代码] #include<bits/s ...

  2. 【POJ 1222】 EXTENDED LIGHTS OUT

    [题目链接] http://poj.org/problem?id=1222 [算法] 列出异或方程组,用高斯消元求解即可 [代码] #include <algorithm> #includ ...

  3. day63-webservice 10.jquery的调用webservice小练习

    客户端是采用jquery方式来做调用.但是这种调用,因为jquery这种调用你就得有消息体.我们得先拿到这种消息体.PersonService这个服务类有两个方法. http://localhost: ...

  4. numpy快速指南

    Quickstart tutorial 引用https://docs.scipy.org/doc/numpy-dev/user/quickstart.html Prerequisites Before ...

  5. vuex的状态管理模式

    1.store.js Vuex 通过 store 选项,提供了一种机制将状态从根组件“注入”到每一个子组件中(需调用 Vue.use(Vuex)) state:存放数据. mutations:提交状态 ...

  6. GCC G++ Make CMake自我科普

    Linux下gcc g++ make cmake 联系和区别 C/C++程序从编写到可执行一般经历这几个阶段 编写源代码 编译器编译代码生成目标文件,如.o文件 链接器链接目标文件和其他目标文件/库文 ...

  7. 【Oracle】ORA-01157: cannot identify/lock data file 201 - see DBWR trace file

    今天数据库在查询数据的时候显示了这个错误: ORA-01157: cannot identify/lock data file 201 - see DBWR trace file ORA-01110: ...

  8. 快速登录MySQL数据库

    [root@tdh51 docker]# mysql -h localhost -u transwarp -p$(cat /etc/transwarp-manager/master/db.proper ...

  9. matplotlib简介-高质量图形输出

    Matplotlib 是一个用来绘制二维图形的 Python 模块,它克隆了许多 Matlab 中的函数, 用以帮助 Python 用户轻松获得高质量(达到出版水平)的二维图形. 文章来源:http: ...

  10. vue项目中引用echarts的几种方式

    准备工作: 首先我们初始化一个vue项目,执行vue init webpack echart,接着我们进入初始化的项目下.安装echarts, npm install echarts -S //或   ...