InMotion Hosting Support Center
This page will assist you with troubleshooting a MySQL - 1044 "Access Denied" Error Message.
When you import a database using phpMyAdmin, generally you are importing a text file with a .sql extension.
Here is a section of code that may be in a .sql database backup. In this example, the database we are trying to import is named employees.

-- phpMyAdmin SQL Dump
-- version 2.11.9.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 02, 2010 at 08:01 AM
-- Server version: 5.0.81
-- PHP Version: 5.2.6
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
CREATE DATABASE employees;
-- --------------------------------------------------------
--
-- Table structure for table `employee_list`
--
CREATE TABLE IF NOT EXISTS `employee_list` (
`first_name` text NOT NULL,
`last_name` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

When using phpMyAdmin to attempt to import such a file, you will receive an error message similar to:
Error
SQL query:
CREATE DATABASE employees;
MySQL said: Documentation
#1044 - Access denied for user 'training'@'localhost' to database 'employees'

In this scenario, my cPanel username is training. Because of cPanel's database naming conventions, all database names must begin with the cPanel username followed by an _. I cannot create a database named employees, however I can create a database named training_employees.
The reason this import failed is because of the following line in the .sql file (shown above)

CREATE DATABASE employees

Again, I cannot create a database named employees, however I can create a database named training_employees.

If I change the line that says:
CREATE DATABASE
so that it creates:
training_employees
instead of employees
it will again fail with the following message:
Error
SQL query:
CREATE DATABASE training_employees;
MySQL said: Documentation
#1044 - Access denied for user 'training'@'localhost' to database 'training_employees'

When using cPanel, databases must be created within the cPanel itself.
To fix the issue, you will need to:
  1. Create the: training_employees database within cPanel
  2. Comment out the: CREATE DATABASE command in my .sql file. To do this, simply change: CREATE DATABASE employees; to -- CREATE DATABASE employees; You are simply adding dash dash space to the front of the line to comment it out so that it will not be executed.
  3. Log into phpMyAdmin, access the training_employees database, and then import as normal

Support Center Login

Social Media Login

   
Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
n/a Points
2014-04-04 8:30 pm

Thank you. Really struggled as a newbie to SQL and found your article which sorted everything out....thanks so much!!!

n/a Points
2014-04-16 4:20 am

How do you comment out the statement in the .sql file? is there an editor for it?

Staff
16,896 Points
2014-04-16 9:33 am
Hello Beep,

Thank you for your question. You can edit the .sql file with a text editor, such as notepad in Windows:

  1. Right click the .sql file.

  2. Click Open with

  3. Click notepad

If you have any further questions, feel free to post them below.
Thank you,

-John-Paul
n/a Points
2015-03-28 11:51 pm

Dear sir, madam,

i don't know why i cannot import database.

it is alway send an Error Message as bellow if i create by sql:

MySQL said: Documentation

#1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation

 

another Error if i import database, it as bellow:

 

SQL query:

 

 

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

 

MySQL said: Documentation

#1044 - Access denied for user 'esccam5'@'localhost' to database 'news'

Please guide me to do.

my customer suggest me to do it as soon as possible.

 

 

thanks.

 

Best Regards,

Duong sokheng

Staff
28,219 Points
2015-03-30 9:59 am
Hello Duong,

Try to comment out the line: CREATE DATABASE IF NOT EXISTS `news` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

As the database should already be created via the cPanel, this line is not necessary.

Kindest Regards,
Scott M
n/a Points
2014-05-09 5:52 am

how i run php  program in server 

Staff
28,219 Points
2014-05-09 10:55 am
Hello Shiv Krishna,

Files that are written in php and end with the extention .php are interpreted by the php engine on the web server when they are called. You do not have to do anything special to make them run.

Kindest Regards,
Scott M
n/a Points
2014-05-30 7:28 pm

I have this error but in my "local host" installed in my computer by xamp. I can´t access to  my sites and I don´t access to priviliges eigther.

 

 

Staff
25,274 Points
2014-05-30 8:09 pm
Hello Sara,

I'm sorry to hear that you're having problems with your "localhost" computer. Since this issue is not on our servers, I cannot look at it directly. You will need to determine the proper user access credentials for the user that is accessing the database. That is the core of the problem. If you have no privileges to access the database or change the permissions, then you will not be able to correct the issue. Unfortunately, since the server is not something we can control, then we cannot take action to fix the problem.

I hope this helps to lead you to the solution. Please let us know if you have any further questions or comments.

Regards,
Arnel C.
n/a Points
2014-06-03 6:35 am

Hello everyone,

I installed xampp created .php extension files and added database through mysql.

My whole code is running nicely on my laptop,but when I uploaded my files in a free hosting account. error "Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO) in /home/u153721562/public_html/SF/connect.inc.php on line 7 Access denied for user 'root'@'localhost' (using password: NO)" came and my files are not running.

Please suggest some measures to sort it out.

Staff
11,186 Points
2014-06-03 8:04 am
This is due to a password not being defined and your MySQL server requiring one. You will need to define the correct user and password within your code to appropriately connect to your MySQL server.
n/a Points
2014-06-03 8:31 am

Could you give me the appropriate code for changing the password of root user.

and how to then connect to database/localhost

Staff
11,186 Points
2014-06-03 8:35 am
We are not very familiar with XAMPP, but I was able to find an article on changing your MySQL root password in XAMPP.

Once done, you will need to adjust any code that you have written to connect to the database. This step can greatly vary and if you are unsure of how to do so, I recommend contacting your developer.
n/a Points
2014-07-21 11:41 am

Hey mate, May be its kind of late now but in case you are still stuck with the same issue, you need to edit your connection.php file or whatever file you use to connect to database. change the username and the password to the ones you use to log in to the cpanel. That will solve the problem

n/a Points
2014-06-07 2:13 pm

I have followed all of the steps of the article. I have created a database equivalent to the "training_employee" example, but this is where it goes haywire. Do I copy and paste the "employee" databse equivalent and paste it into the SQL of my "training_employee" database or do I edit the "employee" database and import it into the "training_employee" database? Sorry if this was confusing!

Staff
28,219 Points
2014-06-09 12:08 pm
Hello Mora,

If you are moving data from one database to another, you can simply export the data from the source database and then import it into the target database. This is provided both have been created in the cPanel.

If that does not answer your question, please reply so that I may continue to assist.

Kindest Regards,
Scott M
n/a Points
2014-07-05 11:20 am

When I Import my database into phpmyadmin it have some problem that mean error SQL query: Dumping data for table 'cds' it how can I fix it this kinds of problem please! Please suggest me.

Staff
9,968 Points
2014-07-06 3:06 am
Hello Girmaye,

Usually when that happens it means the database you're trying to import the backup into already has a cds table.

You might want to check before running your import, and drop all of the tables from the current database.

To drop all tables in phpMyAdmin you would simply click on the database name on the left, and then click on the Check All checkbox. Next from the With Selected: drop-down, choose Drop.

Hopefully that helps, if not please let us know if the SQL error mentions anything else that might be of help to us troubleshooting it.

- Jacob
n/a Points
2014-08-25 5:07 pm

I did exactly as you say in the tuto but it gave me this message:

Import has been successfully finished, 0 queries executed. (c374739_dictionnaire25_08_14.sql.zip)

==================================

or before your tuto the error message was:

Error

SQL query:

---- Database: `c374739_dictionnaire`--CREATE DATABASE IF NOT EXISTS `c374739_dictionnaire` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

MySQL said: Documentation#1044 - Access denied for user 'C374739_kalle'@'%' to database 'c374739_dictionnaire'

===============================================

 

-- phpMyAdmin SQL Dump-- version 4.0.4-- http://www.phpmyadmin.net---- Host: localhost-- Generation Time: Aug 25, 2014 at 08:19 PM-- Server version: 5.6.12-log-- PHP Version: 5.4.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;/*!40101 SET NAMES utf8 */;

---- Database: `c374739_dictionnaire`--CREATE DATABASE IF NOT EXISTS `c374739_dictionnaire` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;USE `c374739_dictionnaire`;

-- --------------------------------------------------------

---- Table structure for table `mots`--

DROP TABLE IF EXISTS `mots`;CREATE TABLE IF NOT EXISTS `mots` (  `ID` smallint(6) NOT NULL AUTO_INCREMENT,  `mot` varchar(250) NOT NULL,  `audio` varchar(500) NOT NULL DEFAULT 'defaultDefault.WAV',  `definition` varchar(10000) NOT NULL,  `son` varchar(500) NOT NULL DEFAULT 'defaultDefault.WAV',  PRIMARY KEY (`ID`)) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2018 ;

Staff
25,274 Points
2014-08-25 5:55 pm
Hello Kayen,

Sorry to hear that you're having problems with a database import. The article written above was done with understanding that you're using cPanel and a system similar to our own hosting setup here. By default, databases are named in a specific convention per the user name on your account. Your error messages indicate you're not using our conventions, so the error message is probably different in your case. It may have to do with your level access to the database. The instructions above are bypassing the creation of the table section and you're doing it with PHPMYADMIN. Then you should be running an import with an SQL file, not a ZIP file. The message that you've given to us indicates you're trying to run the ZIP file for the import. Please review your import process. Again, we generally try to provide advice on all types of issues - but our main focus is providing support for InMotion's hosting service and our system. In the event that we may not be able to provide the information you require, then you may need to seek the advice of a programmer. They would be required to to perform the necessary changes for your code to work.


Kindest regards,
Arnel C.

n/a Points
2014-08-25 7:39 pm

 

 

here is error message after made the change in the line:

-- Database: `c374739_dictionnaire`----CREATE DATABASE IF NOT EXISTS `c374739_dictionnaire` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;--USE `c374739_dictionnaire`;

 

Error

SQL query:

---- Database: `c374739_dictionnaire`-- - - CREATE DATABASE IF NOT EXISTS `c374739_dictionnaire` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--CREATE DATABASE IF NOT EXISTS `c374739_dictionnaire` DEFAULT CHARACTER SET utf' at line 4

before it was :

-- phpMyAdmin SQL Dump-- version 4.0.4-- http://www.phpmyadmin.net---- Host: localhost-- Generation Time: Aug 25, 2014 at 11:24 PM-- Server version: 5.6.12-log-- PHP Version: 5.4.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;/*!40101 SET NAMES utf8 */;

---- Database: `c374739_dictionnaire`--CREATE DATABASE IF NOT EXISTS `c374739_dictionnaire` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;USE `c374739_dictionnaire`;

I need help!!!!!!!!!!!!   thank you

Best regard

 

Staff
25,274 Points
2014-08-25 9:25 pm
Hello Kayen,

As per our previous response, we may not be able to provide a response that requires that you contact a programmer. In this case, you are showing a different error which indicates a SYNTAX error. Typically, in this case, it means that you may have code that is no longer supported by the version of MySQL that you are running. MySQL code is continually updated, so if you are using code that was written for an older version of MySQL, then you will need to update the MySQL code to match the version that you are currently running. Click here to determine the version of MySQL that you are running. You can also visit our document called Finding your MySQL version for the same information.

If you go to the official MySQL documentation, you will see the documentation for the versions in the left hand column. You will need to look at the syntax and correct it for the version that you are running on your server.

We do apologize that we cannot give you a DIRECT answer. You will need to work with a programmer if you are unable to update your MySQL code.

Kindest regards,
Arnel C.
n/a Points
2014-12-03 7:55 am
Hello, I'm using dreamweaver cs 5 when I'm trying to create a data base using this : it says: Error creating database: Access denied for user ''@'localhost' to database 'facellaneousdatabase' anyone can help me please?
Staff
28,219 Points
2014-12-03 12:00 pm
Hello Nirva,

It appears that the error message you provided reads as: ''@'localhost' to database 'facellaneousdatabase'

It should have a database user name in it, so it would appear as 'username'@'localhost'. This means that your application does not have a username involved. That is why you are getting the error. You will need to ensure the code is using a database user when connecting.

Kindest Regards,
Scott M
n/a Points
2015-01-14 4:36 pm

Hi,Thanks for the post, but it doesn't work for me so I need your help I just started to do some AJAX,PHP and MySQL tutorial from Tuts+ and need to import 'sakila-schema.sql' to my database ( FROM HERE http://dev.mysql.com/doc/index-other.html )   , but I ended up having error replaySQL query:DROP SCHEMA IF EXISTS sakila;MySQL said: Documentation#1044 - Access denied for user 'bojanarcon'@'localhost' to database 'sakila' This is how it looks first few rows of the 'sakila-schema.sql' SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';DROP SCHEMA IF EXISTS sakila;CREATE SCHEMA sakila;USE sakila;---- Table structure for table `actor`--CREATE TABLE actor (  actor_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,  first_name VARCHAR(45) NOT NULL,  last_name VARCHAR(45) NOT NULL, ............

Staff
28,219 Points
2015-01-15 10:56 am
Hello Bojan,

This error is usually due to either the username, password, host, or database name being incorrect. First be sure that all of those credentials are correct. If that passes, you will want to check the user privileges for that user to ensure they have the rights to do everything in the sql file. If it runs across a command it does not have access to run, then it may give this error.


Kindest Regards,
Scott M
n/a Points
2015-01-15 2:35 pm

Thank you Scott for replaying so fast, but I am not sure if I understand use of username. I gave all of the priveledges to the username, I can see in MySQL database that username has all priveledges on chosen database. Is there something that I should maybe uncheck or do I have problem with host, that I can not import it. Do I have to adiionaly sign in username somewhere in phpmyadmin while trying to import, because I don't see that option...

At the end I am following a tutorial on the topic, but I ended not going farther.

I have seen some forums saying that you should or delete in text editor or comment it with "--", the part on beginning CREATE or in my case DROP.   I tried it all but still nothing

Staff
16,896 Points
2015-01-15 3:51 pm
Helo Bojan,

Thank you for contacting us. As Scott suggested, I would double check the spelling of your username, password, or database name. You can view your database name, and username by following our guide on How to find which users are attached to databases

For example in your sample it shows:
'bojanarcon'@'localhost' to database 'sakila'

Typically a database and username would include a prefix, for example:
'inmotion_bojanarcon'@'localhost' to database 'inmotion_sakila'

I hope this helps,
John-Paul
n/a Points
2015-01-31 11:03 am

Please am new to all this.. am trying to use the phpmyadmin on my cpanel.. but it not giving me the option to create database.. but when i check my settings /Main panel it shows that... "Show create database form" is "DISABLED"..

please i need help on this!

Staff
28,219 Points
2015-02-02 2:53 pm
Hello Adams,

phpMyAdmin does not allow the creation of a database. That is done with the MySQL database tool located in the cPanel under the database category.

Kindest Regards,
Scott M
n/a Points
2015-02-15 1:19 pm

I'm still getting the same error. The dash (--) that you say is already there so is it not working? Pls help. Thanks!

Staff
28,219 Points
2015-02-16 12:50 pm
Hello Sarla,

The dashes (--) make that line a comment so that it is not run. However, to import a file, the database already needs to have been created within the cPanel. Have you confirmed that was done already? If so, try removing the line about creating the database entirely and see if that helps.

Kindest Regards,
Scott M
n/a Points
2015-03-20 7:49 am

Hello,

I tried -- in uploading issue , and it uploaded successfully

but I have only tthe home page working then I have an error :

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@learnarabics.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Apache Server at learnarabics.com Port 80 ------------------------------------------------------------------------------------------Thank you in advancewafaa
Staff
28,219 Points
2015-03-23 1:41 pm
Hello Wafaa,

This article is about the 1044 error. You may want to check out our article on 500 errors and the most common causes.

Kindest Regards,
Scott M
n/a Points
2015-05-01 4:11 pm

You solved my problem I had for ages in less than 10 minutes. Would give this solution a 10/10 rating

n/a Points
2015-06-02 11:36 am

thanks for the information. 

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

39 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!