How to import WordPress SQL database backup file without having ‘create new database’ privileges in phpMyAdmin
Categories: Troubleshooting
In this article I have explained how you can import your WordPress SQL database backup file even when you do not have the ‘create new database’ privilege in phpMyAdmin. This is particularly useful when you are trying to import the SQL database as part of transferring your site from one host (old-host.com) to another host (new-host.com) and your new host doesn’t have the ‘Create new database’ privilege in phpMyAdmin.
In your phpMyAdmin page check for the ‘create new database’ privilege. If the privilege settings looks like the example shown below then your database import following the normal method is going to fail as it will try to create a database and you don’t have permission to do that.
You will get the following error when trying to import the database file:
#1044 – Access denied for user ‘username’@'localhost’ to database ‘database_name’
To get around this problem and to complete importing your database to your new host do the following:
- Login to your cPanel and click on ‘MySQL Databases’.
- Create a new database with your preferred name (I am going to use the name ‘newDB‘ for easy reference. You should have privilege to create a new database through this MySQL Database panel even though you don’t have privilege to create new database through phpMyAdmin).
- Open the sql database file that you are using for importing (e.g. ‘localhost.sql‘) in a text editor such as notepad.
- Search for the text “CREATE DATABASE”
- Delete this line containing the create database command.
- In the next line change the database name (tips_tricks in this case) to the newly created database (newDB) in step2 after the word ‘USE’.
- Now use the import wizard from phpMyAdmin to import the database and it will use the already created database to import all the tables without any problem.
Example of the sql database file before modifying
–
– Database: `tips_tricks`
–
CREATE DATABASE `tips_tricks` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `tips_tricks`;
Example of the sql database file after modifying
CREATE DATABASE `applewoo_applewood` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `newDB`;
Alternatively, you could request your web hosting provider to add database creation privilege to your phpMyAdmin.
Hope this will help anyone having a similar problem. Feel free to share your thoughts by leaving comments in the comment area below.
Articles you may also like:









#1 by admin on November 19, 2011 - 9:47 pm
@Starfall, as long as it is backing up your SQL database, it is essentially the same thing. When you backup from your cPanel, you just get more control over the backup operation.
#2 by starfall on November 19, 2011 - 1:54 am
What’s the difference between having backup in cpanel database and through backend database? Sorry but im not that expert much about wordpress backend. thanks in advance.
#3 by Martin on October 28, 2011 - 12:40 pm
Hi, I’ve found another solution that works too:
1. In phpMyAdmin select your database first – you can see listing of all tables
2. Click the Export tab and there select all tables to export, and export as usual
Exported file then doesn’t contain any ‘create database’ queries, so you don’t need to remove these lines.
#4 by Fritz on October 21, 2011 - 10:21 pm
omg thank you for this sexy article.
#5 by Lowell on October 4, 2011 - 3:17 pm
Thanks a bunch for this. Awesome site BTY!
#6 by admin on September 12, 2011 - 11:35 pm
@Sourabh, If you do not have ‘root’ access to the server, ask your host to do this for you.
#7 by Sourabh on September 12, 2011 - 1:34 pm
thanx for info but im gettin this on importing..plz help me to fix it.
SQL query:
–
– Database: ` b6_8637033_wordpress`
–
USE ` b6_8637033_wordpress` ;
MySQL said:
#1044 – Access denied for user ‘b6_8637033′@’%’ to database ‘ b6_8637033_wordpress’
#8 by Doc Holiday on August 7, 2011 - 3:48 am
That’s one of the best and easy to understand tips I have seen in regards to using phpMyAdmin.
You could be a professor
#9 by Technopolis Web Dsigners on August 4, 2011 - 1:06 pm
That helped me a lot. thanks man.
I love the way you explain things, best practical article on the subject.
#10 by sebastian on July 16, 2011 - 4:41 am
thanks a lot!!! tha only solution that I found that works. simple and clear
#11 by Ken on May 23, 2011 - 3:28 pm
Thank you! Worked like a dream!
#12 by Laurie on April 24, 2011 - 9:44 pm
I have spent most of the afternoon trying to figure this out! Yours was the only solution that helped – thanks!
#13 by Michelle on March 22, 2011 - 1:22 am
Thank you so much! Your a life saver. I was moving the company blog from a sub to the main level and ran into that issue. I looked everywhere and your tutorial was the only one that helped. Thanks again.
#14 by Rahul on January 28, 2011 - 12:43 pm
thanks man great post ,it helped me a lot
thank you X10000
#15 by Fran on January 25, 2011 - 6:38 pm
Thanks !
I’ve lost 2 days until I’ve stumbled upon your explanation. Great !
#16 by Joel C on January 12, 2011 - 8:31 am
Freakin life saver! Cheers.
#17 by JP Caparas on November 22, 2010 - 12:27 pm
I coudl give you a hug right now, man! I love you!
#18 by Will Quick on September 29, 2010 - 8:56 am
Oh my God, I LOVE you! Thank you SO SO much! I’ve been struggling with this for hours. I’m trying to move a clients WordPress from one hosting account to another and these error messages were driving me INSANE. You have just saved my life and my sanity.
Honestly, I can’t thank you enough, I’m absolutely overjoyed, haha!
Thanks again,
Will
#19 by Casey on September 20, 2010 - 1:43 pm
Wow. That just SAVED ME. Really appreciate it. I was calling friends, begging the internets to help me.
.-= Casey´s last blog ..Heating Ann Arbor- What does the Future Holds for Home Furnaces =-.
#20 by Sara on August 4, 2010 - 4:35 pm
You Rock! Thank you!
#21 by Gordon on June 10, 2010 - 12:38 am
Thank you so much for putting this info up,so very grateful.
#22 by Nagashiko on May 26, 2010 - 5:32 pm
This post is very helpful for people like me who doesn’t know that much about IT stuff. The instructions were easy to follow! Thanks so much for the info! =D
.-= Nagashiko´s last blog ..Try to guess what my excuse would be… =-.
#23 by best wordpress plugin on May 15, 2010 - 1:52 pm
Good post. But, im still confusing about this! Maybe i must try this again. Thanks!
.-= best wordpress plugin´s last blog ..mike brown fired =-.
#24 by search engine optimization seo services on December 15, 2009 - 5:41 pm
This is just what I needed to know. So glad I found your blog because I was ready to pull my hair out!
.-= search engine optimization seo services´s last blog ..October Was Breast Cancer Awareness Month: Raising Breast Cancer Awareness in a Hospital =-.
#25 by Nedbenj on October 28, 2009 - 4:38 pm
You’re a genius
.
Thanks a lot for this handy tip, I spent hours trying to get this to work before seeing your post.
.-= Nedbenj´s last blog ..Ban the Bag! =-.
#26 by Watashiii on June 3, 2009 - 8:57 am
Thank you thank you! I love you and I want to have your babies
#27 by admin on May 31, 2009 - 1:08 pm
@Roady, what charset are you using?
#28 by Roady on May 29, 2009 - 5:59 pm
I took the backup of my database of wordpress though the cpanel -> backup > mysql . When I open it, The text is not in english and in some other weird language. Any thing I can do with this file to get my database back up?
Thanks
#29 by admin on April 21, 2009 - 10:10 pm
@abbie, this should be easy.. just use the database of the existing blog and run the SQL commands using phpMyAdmin to add the data of the old blog to this new one.
So…
1. Back up the SQL file of your old blog using phpMyAdmin.
2. open the recently downloaded backup SQL file and change the line where it says create database to use the database name of the new blog.
3. Execute the content of the SQL file in the phpMyAdmin of your new blog so it inserts all the entries to this database.
#30 by abbie on April 21, 2009 - 9:42 am
Hi Admin,
Thanks for sharing this info.
So.. we have to make a new database. What if I want to import a downloaded sql from an old blog to an existing new blog that has had posts and comments already, so that the (different) posts and comments in the old blog inserted into the new blog?
Any suggest would be highly appreciated. Thx..
#31 by Brendon on January 9, 2009 - 5:40 am
Exactly what I was looking for. I was transferring my blog and I got the error when importing the SQL database. Glad to have found this post!
#32 by admin on January 5, 2009 - 8:48 pm
@Gina I am glad that the explanation solved your database import issue. I was terrified when I was getting errors trying to import my wordpress database from my old hosting to the new hosting using phpMyAdmin.
#33 by Gina Alessia on January 5, 2009 - 8:23 pm
Thank you, thank you, thank you. Just what i needed, best explanation possible.