Importing MySql database to new host-#1044 - Access denied for user error, what am I doing wrong?

16 replies
Warriors,

I'm trying to import a MySql WordPress database to another host for someone who bought one of my blogs.

I exported my database and saved it as a file

I created a database at their hosting.
I created a user name at their hosting for the new database

I try to import the database and I get this error:


SQL query:
CREATE DATABASE `nameofdatabase` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
MySQL said:
#1044 - Access denied for user 'their username'@'localhost' to database 'the database name'

What am I doing wrong here?
#access #database #denied #error #host #host#1044 #importing #mysql #user #wrong
  • Profile picture of the author john_kennedy
    It looks to me like it is trying to create another database. Can you post the first few lines after all the comments at the top?

    John
    {{ DiscussionBoard.errors[1131769].message }}
  • Profile picture of the author jonhel
    Does the database user have sufficient permissions to create tables etc. for the new database?
    {{ DiscussionBoard.errors[1131771].message }}
  • Profile picture of the author john_kennedy
    phpMyadmin runs as the username and doesn't rely on the db having any users assigned to it. Try it out. Create a blank db, assign no users and the import a sql file.

    John
    {{ DiscussionBoard.errors[1131790].message }}
  • Profile picture of the author Jason_V
    I figured it out guys, thank you.

    I forgot to create a new user at the old database with the same name of the new user at the new database before I backed up and exported the database.

    For example, at the new hosting site, I create a new database and I make a new user JohnSmith

    I forgot I had to add JohnSmith as a user at the existing database before I exported it and imported it to the new site.

    For anyone else who may stumble upon this down the line, make sure the password for the user are the same at both sites too.
    Signature
    "When you do something exactly wrong, you always turn up something."
    -Andy Warhol
    {{ DiscussionBoard.errors[1131888].message }}
  • Profile picture of the author Nubieteky
    thanks Jason V for figuring this out i could have not done this without this thread.
    I have seen a lot of sql tutorials videos and i didn't know that i could be this easy.
    Signature
    Photo and Video Coverage Alabang - Community for the Uploader, Internet Marketer and Webmaster
    {{ DiscussionBoard.errors[3392590].message }}
    • Profile picture of the author entry
      Ask your host provider, if they are clever enough they will give you the answer
      Signature
      I Have to say a Massive...THANK YOU to every Warrior who has helped me, and thanks to every warrior who helps me in the future...
      {{ DiscussionBoard.errors[3392946].message }}
      • Profile picture of the author whizzee
        Not necessarily Jason. Yes these are the steps required prior to have a proper connection but it is not necessary to have the same and old user name and database name. You can change the user name and database name to the new one and can get connected. Simply ammend the config file.
        {{ DiscussionBoard.errors[4983285].message }}
        • Profile picture of the author rickblackmon
          I am trying to install and use Domain Deindexing Software from Norrth Software and get a #1044 access denied error. Here is what I have done:
          Created a new mysql database from the cpanel.
          created a user, and a password and added the user to the database as I have done many times.
          When I try to access the file through the url, I get the error. The error I am getting is:
          Domain Indexing System
          Database Error
          Message: Could not connect to server: localhost.
          MySQL Error: Access denied for user 'imauser'@'localhost' (using password: NO)
          Date: Sunday, December 25, 2011 at 12:08:58 PM
          Script: /admin.php
          Database Error
          Message: Could not open database: .
          MySQL Error: Access denied for user 'imauser'@'localhost' (using password: NO)
          Date: Sunday, December 25, 2011 at 12:08:58 PM
          Script: /admin.php
          Database Error
          Message: MySQL Query fail: SELECT id FROM domains WHERE last_checked != '2011-12-25' AND banned = '0'
          MySQL Error: Access denied for user 'imauser'@'localhost' (using password: NO)
          Date: Sunday, December 25, 2011 at 12:08:58 PM
          Script: /admin.php
          Database Error
          Message: Could not connect to server: localhost.
          MySQL Error: Access denied for user 'imauser'@'localhost' (using password: NO)
          Date: Sunday, December 25, 2011 at 12:08:58 PM
          Script: /admin.php

          Several people on the OLT forum have installed this software successfully and really like it. The user id referenced in the error is the user id for the cpanel and it has all privileges. Can anyone hel here? Thanks in advance.
          {{ DiscussionBoard.errors[5301106].message }}
  • Profile picture of the author CyberAlien
    Creating a user along with a password doesn't help because your script isn't using the password. It is sending the username imauser but there isn't a password being sent.

    Code:
    Access denied for user 'imauser'@'localhost' (using password: NO)
    {{ DiscussionBoard.errors[5301657].message }}
  • Profile picture of the author salesd
    I have the same problem with wordpress script. I know the config file but I can change that until I have everything moved to the new host.

    My question is on the user name change. On my first host the user names are similar to hosta_username while the second host is something like hostB_user name. The question is the first part hostA_ is that part of the user name. If it is, you cant change the user name as the first part (hostA) automatically comes up.

    Or can I just change the user name part.

    Thanks
    {{ DiscussionBoard.errors[5508733].message }}
    • Profile picture of the author brodywebdesign
      All you need to do is open the sql file in a text / notepad and "Find & Replace" all url addresses to the new one if that differs.

      If you are keeping the same domain name, all you have to do is edit / remove the portion of the sql file in the beginning that wants to create a new database.

      The reason it's wanting to connect to create a new database is because Wordpress is an install script to automatically setup tables, but if you move it you need to edit that portion.

      Thanks.
      {{ DiscussionBoard.errors[6567029].message }}
  • Profile picture of the author auro
    I had the same problem and I found out I exported from localhost, so when importing it was trying to create the database.

    I solved it clicking on the tab Databases, then on the name of the databse and then on the export tab.
    You will see on the left you can select all the tables (instead of the database).
    cheers
    {{ DiscussionBoard.errors[7991587].message }}
    • Profile picture of the author Amgeek
      I found a quick answer here: MySQL - 1044 Access Denied Error Message | InMotion Hosting

      In essence, just put -- in front of the "create database" line(s) in the first part of the file.

      Amgeek
      {{ DiscussionBoard.errors[8679476].message }}
      • Profile picture of the author mojojuju
        Originally Posted by Amgeek View Post

        I found a quick answer here: MySQL - 1044 Access Denied Error Message | InMotion Hosting

        In essence, just put -- in front of the "create database" line(s) in the first part of the file.

        Amgeek
        That's not really a quick answer, since OP started this thread 4 years ago. :rolleyes:
        Signature

        :)

        {{ DiscussionBoard.errors[8679998].message }}
      • Profile picture of the author philipstancil
        Originally Posted by Amgeek View Post

        I found a quick answer here: MySQL - 1044 Access Denied Error Message | InMotion Hosting

        In essence, just put -- in front of the "create database" line(s) in the first part of the file.

        Amgeek
        Thank you, Amgeek! Your post led me to my ultimate solution, which was to just delete that line. When I put the -- in front of my line, I kept getting an error due to what I believe was a character encoding issue. Anyway, after deleting the line, the sql file imported successfully!
        {{ DiscussionBoard.errors[8887771].message }}
        • Profile picture of the author Karen Blundell
          the two answers above that I thanked are the correct answers - as long as you give a user the correct permissions for the database in question it can be 2 different usernames - it will work - you would then just need to make the appropriate changes on the config file
          Signature
          ---------------
          {{ DiscussionBoard.errors[8890401].message }}

Trending Topics