简体   繁体   English

用户不存在于MySQL,c#和asp.NET MVC中

[英]User does not exist in MySQL , c# and asp.NET MVC

I am working on development machine without making any user account [i have three of four account who comes when i installed them]. 我在开发计算机上工作时没有建立任何用户帐户[安装它们时,我有四个帐户中的三个]。

so i open the connection everywhere by a globals variable who hold the connectionstring off-course value of variable can not be changed it's constant. 因此,我通过一个全局变量在任何地方打开连接,该全局变量持有该连接字符串的偏离值,该变量的值无法更改,它是恒定的。

i open the connection using root account who come by default in mysql server. 我使用默认在mysql服务器中出现的root帐户打开连接。 they work fine everywhere. 他们到处都很好。

but my code try to run a command then server return the error that 但是我的代码尝试运行命令,然后服务器返回错误

The user specified as a definer ('admin'@'localhost') does not exist

i don't know why i got this error even in debug i found that connection open by root and they work fine everywhere else. 我不知道为什么即使在调试中也遇到此错误,我发现该连接是由root打开的,并且在其他地方都可以正常工作。

so the problem is why they tell me about admin@localhost even the connection my code open by root. 所以问题是为什么他们告诉我有关admin @ localhost的信息,甚至我的代码是由root打开的。

are their anything my code try to do who need authentication or need admin account even they not have then give me exception. 是我的代码尝试执行的所有操作,这些操作需要身份验证或需要管理员帐户,即使他们没有,也要给我例外。

Are you know that what is gone wrong. 您知道发生了什么问题吗?

I got this error after DB was moved to another server. 将数据库移至另一台服务器后,出现此错误。 There no such user 'admin' so I got the error. 没有这样的用户“管理员”,所以我得到了错误。

Solution: 解:
log into mysql as root 以root身份登录mysql

grant all on *.* to admin@localhost identified by "s!5_superp@ss!";
flush privileges;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM