Question

I'm getting an error:

 #1044 - Access denied for user 'host_adminman'@'localhost' to database 'testdb4' 

I thing that it should be denied, since the user/pass combo for MySQL 5.6 that was used on my PC while developing DB do not match ones I got from host. I've found explanation from HostGator that:

"The problem here is your import file contains an SQL query that attempts to create a database for the wrong username. Notice the user2 in 'user2_wrdp9' does not match the username1 in 'username1'@'localhost'. Someone must edit the import file and change the old user2 to your new username1.

So, how do I do that?

I have MySQL Workbench installed. Added, the same username as on the host, gave it all privileges to 'testdb4', exported database in a SQL file, but I still get this error when I try to import it on the host.

Was it helpful?

Solution

Did somebody use phpmyadmin to create this import file?

If so, can you get them to do it again?

If so, can they use the "custom-display all possible options" item in the phpmyadmin export panel? That will allow them to uncheck the "Add CREATE DATABASE / USE statement" and redo the export. That should get rid of your problem with the import.

If you can't get the export file remade, you can use a simple text editor (for example, the notepad program on Windows) to fix up the import SQL file.

If the filename ends in .zip or .gz or some such, you need to uncompress it first.

Then open it up in the text editor. Right near the beginning of the file you'll find lines like these:

--
-- Database: `blah_blah`
--
CREATE DATABASE IF NOT EXISTS `blah_blah` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `blah_blah`;

Delete them and save the file. Then try importing it again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top