Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

How can I fix this?

like image 537
Gopal1216 Avatar asked Mar 28 '14 09:03

Gopal1216


2 Answers

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).

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".

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

like image 95
Isaac Bennetch Avatar answered Oct 22 '22 03:10

Isaac Bennetch


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.

like image 39
Plummer Avatar answered Oct 22 '22 03:10

Plummer