在Windows中更改默认的MySQL用户 [英] Changing the default MySQL user in Windows

查看:55
本文介绍了在Windows中更改默认的MySQL用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我从命令提示符下运行 mysql mysqldump 程序,则会在Windows中看到此错误: ERROR 1045(28000):用户'的访问被拒绝ODBC'@'localhost'(使用密码:否).我知道'ODBC'是默认用户.有办法改变这个地方吗?

If I run the mysql or mysqldump programs from the command prompt, I get this in Windows:ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO). I understand that 'ODBC' is the default user. Is there a way to change this somewhere?

我经常在Windows和Linux之间来回切换,微小的差异使我丧命.虽然简单的 -u root 键入的次数不多,但忘记它的偶然性是相当令人沮丧的!

I switch back and forth between Windows and Linux quite frequently and the slight difference kills me. While a simple -u root isn't a lot of typing, forgetting it the occasional time is quite frustrating!

推荐答案

看起来像在源代码中进行了硬编码,您必须更改它并自己重新构建.一个常见的技巧是创建一个与可执行文件同名的批处理/bash程序(当然,由于.bat/.exe的执行顺序,即使在Windows上,您也必须首先将可执行文件移至某个位置),以检查空参数.如果它们为空,则在命令后附加"-u root",否则将参数绕到实际可执行文件中

Looks like it's hardcoded in the source code, you have to change that and rebuild it yourself. A common trick would be to create a batch/bash program with the same name as the executable (of course you have to move the executable somewhere first, even on Windows due to .bat/.exe execution order) which checks for empty arguments. If they're empty, append '-u root' to the command, otherwise bypass the arguments to the real executable

这篇关于在Windows中更改默认的MySQL用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆