How to import WordPress SQL database backup file without having ‘create new database’ privileges in phpMyAdmin
Categories: Web Development, Wordpress
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.
No privilege to create new database
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_db 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_db`
–
CREATE DATABASE `tips_db` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `tips_db`;
Example of the sql database file after modifying
CREATE DATABASE `applewoo_applewood` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `newDB`;
Note: Beth pointed out the following in the comment section below which is good to remember:
You have to make sure that you do a search for "CREATE DATABASE" to delete it and make the change to the "USE tips_db" Line in ALL the places it appears.
What to do if you can’t do the above trick?
You could request your web hosting provider to add database creation privilege to your phpMyAdmin.
Also check out the following two tutorials which should be very helpful:
Hope this will help anyone having a similar problem. Feel free to share your thoughts by leaving comments in the comment area below.






#1 by kelskc on April 27, 2013 - 8:39 pm
THANK YOU!! I have been searching everywhere for this solution (not knowing it was this) and not only did it work you made it so easy… you are amazing!
#2 by Beth olson on April 9, 2013 - 8:11 pm
@Sourabh
It’s an easy fix!!
I also kept getting the error: “#1044 – Access denied for user ‘b6_8637033@%’ to database ‘b6_8637033_wordpress’
You have to make sure that you do a search for “CREATE DATABASE” to delete it and make the change to the “USE tips_db” Line in ALL the places it appears. I realized that I was getting that error because I was only changing that information in one place but it was actually occurring in TWO places in the code.
hope that helps!
#3 by Frederico Garza on April 8, 2013 - 1:39 pm
Thank you!!! It worked. It’s rare I see an article helping so many people for four years straight. Thanks again. -Frederico
#4 by Josh on March 17, 2013 - 5:47 am
Thanks, you saved my day
#5 by Arup Ghosh on January 19, 2013 - 2:48 pm
I have no idea about sql database management any this tutorial helped me to bring back my old wordpress website.
#6 by Mike on December 23, 2012 - 8:28 pm
You! Are! Awesome! Wow that was easy. Thanks 100x
#7 by Jinny on December 7, 2012 - 4:50 am
Thank you for this. I’ve been trying to figure this out for ages and stumbled upon your very helpful article. Managed to import successfully at last!
#8 by John on November 23, 2012 - 10:02 am
Absolutely brilliantly simple and works like a dream.
Thanks
John
#9 by Ronnie on November 14, 2012 - 9:26 am
Thanks alot…
#10 by david d on October 2, 2012 - 12:35 pm
saved my ### man thanks!
#11 by pulau tidung on October 1, 2012 - 10:14 pm
Thank you thank you! I love you and I want to have your babies
#12 by Navneet Singh on August 2, 2012 - 2:57 pm
Thank you so much, you help me alot to get my website back
#13 by Rabah Rahil on May 22, 2012 - 7:34 pm
Thank you sooo much this was exactly what I needed!
#14 by beachmatt on April 10, 2012 - 11:53 am
That worked for me, thanks for that.
#15 by Laura B. on March 15, 2012 - 10:23 am
Thank you so much! I had never had this error before and it happened today. All the other answers I found did not work (and didn’t make sense).
Thank you for an easy to understand and effective solution.
#16 by Eric W. on February 17, 2012 - 2:27 am
OMG Thank you thank you thank you. I was SO stuck on why this didn’t work and you saved me.
#17 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.
#18 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.
#19 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.
#20 by Fritz on October 21, 2011 - 10:21 pm
omg thank you for this sexy article.
#21 by Lowell on October 4, 2011 - 3:17 pm
Thanks a bunch for this. Awesome site BTY!
#22 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.
#23 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’
#24 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
#25 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.
#26 by sebastian on July 16, 2011 - 4:41 am
thanks a lot!!! tha only solution that I found that works. simple and clear
#27 by Ken on May 23, 2011 - 3:28 pm
Thank you! Worked like a dream!
#28 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!
#29 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.
#30 by Rahul on January 28, 2011 - 12:43 pm
thanks man great post ,it helped me a lot
thank you X10000
#31 by Fran on January 25, 2011 - 6:38 pm
Thanks !
I’ve lost 2 days until I’ve stumbled upon your explanation. Great !
#32 by Joel C on January 12, 2011 - 8:31 am
Freakin life saver! Cheers.
#33 by JP Caparas on November 22, 2010 - 12:27 pm
I coudl give you a hug right now, man! I love you!
#34 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
#35 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 =-.
#36 by Sara on August 4, 2010 - 4:35 pm
You Rock! Thank you!
#37 by Gordon on June 10, 2010 - 12:38 am
Thank you so much for putting this info up,so very grateful.
#38 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… =-.
#39 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 =-.
#40 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 =-.
#41 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! =-.
#42 by Watashiii on June 3, 2009 - 8:57 am
Thank you thank you! I love you and I want to have your babies
#43 by admin on May 31, 2009 - 1:08 pm
@Roady, what charset are you using?
#44 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
#45 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.
#46 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..
#47 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!