SQL Dump Help

Discussion in 'MySQL' started by Wildcat7173, Jul 11, 2009.

  1. #1
    Alright im trying to perform a bigdump on my sql because it wont import normally cause its to big. When i perform this i get the error message:

    MySQL: Can't create database '2213_bat'; database exists

    So basically what it tells me is that it already exists so what i do is delete it and then run the program again but then i get a message saying that the user doesnt have access to the database even though it doesnt exist.

    So does anyone know how to fix this or ever run into this problem before?
     
    Wildcat7173, Jul 11, 2009 IP
  2. chisara

    chisara Peon

    Messages:
    141
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need to run the import as a user with create database privileges, the admin user is a good choice.
    Find the manual for the mysql import command look for the username parameter, that should do the trick.
     
    chisara, Jul 13, 2009 IP
  3. HivelocityDD

    HivelocityDD Peon

    Messages:
    179
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you are using mysql + linux


    To create the dump you can use the command

    mysqldump -u username -D dbname -p > dump.sql

    To import the dump

    use the command as root

    mysql -u username -p -D dbname < dump.sql

    You need to make sure you create a new database with the dbname before executing the command
     
    HivelocityDD, Jul 13, 2009 IP
  4. webaddict.info

    webaddict.info Banned

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this command has bugs with UTF8 encoding
     
    webaddict.info, Jul 14, 2009 IP
  5. chisara

    chisara Peon

    Messages:
    141
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    chisara, Jul 14, 2009 IP
  6. Wildcat7173

    Wildcat7173 Well-Known Member

    Messages:
    567
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    115
    #6
    Yes that solved the problem thanks for the advice.
     
    Wildcat7173, Jul 14, 2009 IP
  7. chisara

    chisara Peon

    Messages:
    141
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Altough I think the problem with the mysql command is due to your OS/Shell/pipe support.
    If this is fully setup as unicode, then the mysql < version should work as well, unless the mysql program uses different dataparsing routines then mysql_import
     
    chisara, Jul 15, 2009 IP