简体   繁体   English

1044 - 用户 'user'@'localhost' 拒绝访问数据库 'db'

[英]1044 - Access denied for user 'user'@'localhost' to database 'db'

I tried a lot to import the sql script to create database and tables through phpmyadmin in the new site I hosted.我尝试了很多方法来导入 sql 脚本以在我托管的新站点中通过 phpmyadmin 创建数据库和表。 But i'm getting the error,但我得到了错误,

1044 - Access denied for user 'user'@'localhost' to database 'db' 1044 - 用户 'user'@'localhost' 拒绝访问数据库 'db'

I tried to create a sample db directly: create database sampled;我尝试直接创建一个示例数据库:create database sampled; I'm getting the same access denied error.我收到相同的访问被拒绝错误。

I'm not able to grant privileges to the user also, i'm getting the same access denied error.我也无法向用户授予权限,我遇到了相同的访问被拒绝错误。

Following is the output of show grants command,以下是 show grants 命令的 output,

show grants;
GRANT USAGE ON . TO 'someuser'@'localhost' IDENTIFIED BY PASSWORD 'somepw' 

GRANT ALL PRIVILEGES ON someuser\_%.* TO 'someuser'@'localhost' 

Any help would be appreciated.任何帮助,将不胜感激。 thank you.谢谢你。

If you are using Godaddy then don't directly go to phpMyAdmin and run the sql command.如果您使用的是 Godaddy,则不要直接转到 phpMyAdmin 并运行 sql 命令。

You have to go to MySQL® Databases section and create a database there.您必须转到MySQL® 数据库部分并在那里创建一个数据库。 Then create a user and give it the permission to access the database you just created.然后创建一个用户并授予它访问您刚刚创建的数据库的权限 Now you can go to phpMyAdmin and write your SQL commands.现在您可以转到phpMyAdmin并编写您的 SQL 命令。

Hope this helps希望这可以帮助

It is clear that the user someuser do not have proper privilege over the database db .很明显,用户someuser对数据库db没有适当的权限。 You need to grant privileges for the user over the database to correct this issue.您需要授予用户对数据库的权限才能更正此问题。

If you do bot have administrative rights contact your admin for granting privileges to someuser on that db如果您确实 bot 具有管理权限,请联系您的管理员以授予该dbsomeuser权限

Must Ensure that your User_Name, Password and Database name are correct.必须确保您的用户名、密码和数据库名称正确。 If you are Deal with database 'sampled' then type 'sampled' in query instead of 'db' also must ensure that you don't have to use quota(') in Statement.如果您处理数据库 'sampled',则在查询中键入 'sampled' 而不是 'db' 还必须确保您不必在 Statement 中使用 quota(')。

您尚未从本地主机或 Web 服务器正确导出数据库,请按照以下步骤转到本地主机数据库单击导出选项卡,然后选择“自定义 - 显示所有可能的选项”复选框在“输出”部分将打开几个选项将压缩无更改为压缩,现在单击底部的 go 按钮它将正确导出您的数据库,您现在可以导入到托管或任何您想要的地方,而不会出现错误

For me the problem is I'm not having permissions to Create new Databasename or even Modify the name of the Database.对我来说,问题是我无权创建新的 Databasename 甚至修改数据库的名称。 You can contact your admin to avail privileges or if you want to quickly import the .sql file... then you can open the .sql file with text editor and find the following line:您可以联系您的管理员以获取权限,或者如果您想快速导入.sql文件...然后您可以使用文本编辑器打开 .sql 文件并找到以下行:

CREATE DATABASE IF NOT EXISTS `enter the existing db name` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `enter the existing db name`;

After that try to import the .sql file...now you can successfully import all the tables!之后尝试导入.sql文件...现在您可以成功导入所有表!

I had the same problem i solve it buy change the GRANTEE and made the user he can do all the operation in PhpMyAdmin ,follow the steps :我遇到了同样的问题,我解决了它购买更改 GRANTEE 并使用户可以在 PhpMyAdmin 中执行所有操作,请按照以下步骤操作:

  1. Enter to mysql in root permission but :以 root 权限进入 mysql 但:

    sudo mysql Enter the password, and type this : sudo mysql 输入密码,然后输入:

    SELECT * FROM information_schema.user_privileges; SELECT * FROM information_schema.user_privileges; And see the user in IS_GRANTABLE is he yes or no.并查看 IS_GRANTABLE 中的用户是或否。 If he yes then see the PRIVILEGE_TYPE what it might it be just tow operation if it's true add the last operations.如果他是,那么请查看 PRIVILEGE_TYPE 如果它是真的,那么它可能只是拖曳操作,添加最后的操作。 and see this link to change IS_GRANTABLE from no to yes.并查看此链接以将 IS_GRANTABLE 从 no 更改为 yes。 I wish this could help you.我希望这可以帮助你。

I started getting this error message for no reason at all.我开始无缘无故地收到此错误消息。 Solved by using MySQL and the Server menu option;通过使用MySQL和Server menu option; Selected my bitnami_wordpress schema;选择了我的bitnami_wordpress schema; selected the bn_wordpress user;选择了bn_wordpress user; then picked the Administrative Roles tab and granted access to this user.然后选择Administrative Roles选项卡并授予此用户的访问权限。 I had to do this to all of the users that the access was removed from.我必须对所有已删除访问权限的用户执行此操作。

This error can be avoided in the beginning when creating the user account .在开始创建user account时可以避免此错误。 Following commands must be used to create user account having all the PRIVILEDGES .必须使用以下命令来创建具有所有PRIVILEDGESuser account

CREATE USER 'demouser'@'localhost' IDENTIFIED WITH mysql_native_password BY '***';

GRANT ALL PRIVILEGES ON *.* TO 'demouser'@'localhost' WITH GRANT OPTION;

ALTER USER 'demouser'@'localhost' REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;

CREATE DATABASE IF NOT EXISTS 'demouser';

GRANT ALL PRIVILEGES ON `demouser`.* TO 'demouser'@'localhost';

暂无
暂无

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

相关问题 错误 1044 (42000):用户 ''@'localhost' 对数据库 'db' 的访问被拒绝 - ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db' 错误 1044 拒绝用户 ''@'localhost' 访问数据库 - Error 1044 access denied for user ''@'localhost' to database MySQL 1044(42000):使用Mac对用户'@'localhost'到数据库'mysql'的访问被拒绝 - MySQL 1044 (42000): Access denied for user ' '@'localhost' to database 'mysql' with Mac #1044-拒绝用户'root'@'localhost'访问数据库'information_schema' - #1044 - Access denied for user 'root'@'localhost' to database 'information_schema' 错误1044(42000):用户'@'localhost'对数据库'mysql'的访问被拒绝 - ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql' 错误1044(42000):用户''@localhost对数据库的访问被拒绝 - ERROR 1044 (42000) : Access denied for user ' '@localhost to database 错误 1044 (42000):用户 'root'@'localhost' 对数据库 'newdb' 的访问被拒绝 - ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'newdb' #1044-用户'faiskap'@'localhost'对数据库'information_schema'的访问被拒绝 - #1044 - Access denied for user 'faiskap'@'localhost' to database 'information_schema' #1044-用户'someusr'@'localhost'对数据库'somedb'的访问被拒绝 - #1044 - Access denied for user 'someusr'@'localhost' to database 'somedb' 1044-用户'homestead'@ localhost的访问被拒绝 - 1044 - Access denied for user 'homestead'@localhost
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM