MySQL 将数据库导入 phpmyadmin #1044 - 用户访问被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22709105/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 20:19:08  来源:igfitidea点击:

importing a database into phpmyadmin #1044 - Access denied for user

mysqlphpmyadmin

提问by Gopal1216

I have recently purchased web hosting service at godaddy. I have already completed my project and i used xampp. Now i want to import the database which i arleady have. I tried to do it in the normal way by clicking on import and choosing the file. But i'm getting this error

我最近在 Godaddy 购买了网络托管服务。我已经完成了我的项目并且我使用了 xampp。现在我想导入我已经拥有的数据库。我尝试通过单击导入并选择文件以正常方式执行此操作。但我收到这个错误

#1044 - Access denied for user 'gopal'@'%' to database 'socialnew'

#1044 - 用户 'gopal'@'%' 对数据库 'socialnew' 的访问被拒绝

How can I fix this?

我怎样才能解决这个问题?

回答by Isaac Bennetch

Many web hosts only give you access to one database. Your SQL file is trying to create a new database (with a line near the top like CREATE DATABASE `socialnew`...as you see in the error message).

许多网络主机只允许您访问一个数据库。您的 SQL 文件正在尝试创建一个新数据库(在顶部附近有一条线,就像CREATE DATABASE `socialnew`...您在错误消息中看到的那样)。

The likely solution is to not create the database from your script. You can either edit the .sql file manually and remove the lines starting with CREATE DATABASE `socialnew`...and USE `socialnew`;, or, if your phpMyAdmin is pretty up-to-date, you could do the export again from your XAMPP and make sure the checkbox is not selected for "Add CREATE DATABASE / USE statement".

可能的解决方案是不从脚本创建数据库。您可以手动编辑 .sql 文件并删除以CREATE DATABASE `socialnew`...and开头的行USE `socialnew`;,或者,如果您的 phpMyAdmin 是最新的,您可以再次从 XAMPP 导出并确保未选中“添加创建数据库/使用语句”。

Then when doing the import, make sure you're selecting the Import tab from within the database you wish to import to.

然后在进行导入时,确保您从要导入到的数据库中选择“导入”选项卡。

回答by Kuldeep Makwana

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. For More and Accurate Detail visit Following link: http://onephin.com/1044-access-denied-user-user_namelocalhost-database-database_name/

必须确保您的用户名、密码和数据库名称正确。如果您处理数据库 'sampled',则在查询中键入 'sampled' 而不是 'db' 还必须确保您不必在 Statement 中使用 quota(')。如需更多准确的详细信息,请访问以下链接:http: //onephin.com/1044-access-denied-user-user_namelocalhost-database-database_name/

回答by Plummer

You may also open the .sql file in an IDE and just delete the create command.Then, assuming you've navigated to the desired DB import section in phpMyAdmin, you can run the import with the modified file and you should be good to go.

您也可以在 IDE 中打开 .sql 文件,然后删除 create 命令。然后,假设您已导航到 phpMyAdmin 中所需的数据库导入部分,您可以使用修改后的文件运行导入,您应该很高兴.

回答by qwertz01

Export and import just tables of the database:

仅导出和导入数据库的表:

-> open the database in phpmyadmin
-> click to export
-> save the file (you don't have to change any settings)
-> open the database on new server
-> click to import
-> chose the file
-> click to "GO" and you are done...

-> 在 phpmyadmin 中打开数据库
-> 点击导出
-> 保存文件(你不必更改任何设置)
-> 在新服务器上打开数据库
-> 点击导入
-> 选择文件
-> 点击以“开始”,你就完成了……

It was working for me :-)

它对我有用:-)