Error when trying to create a database.

Discussion in 'Databases' started by Sheen91, Jul 26, 2008.

  1. #1
    I am installing a script and you just upload it and you enter your FTP details etc. and it will create a database and start importing the data.

    Everything is fine except when it tries to create the database it gets an error, my login is regalrec, so my databases are, regalrec_xxxx, so I choose my database to be, regalrec_recipes, but when the script tries and create the database it gets this error.:confused:

    Error creating database (Access denied for user 'regalrec'@'localhost' to database 'regalrec_recipes'):(

    Why is this? If you could help that would be awesome! :D

    Thanks:cool:
     
    Sheen91, Jul 26, 2008 IP
  2. optic

    optic Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    With my web host you have to create the database and database user manually. This could be your problem. Have you checked via your control panel if the database and database user exists?
     
    optic, Jul 26, 2008 IP
  3. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #3
    Create the database and data user manually before using it in your script. Also do not forget to assign the privileges to your database user.
     
    kailash, Jul 26, 2008 IP
  4. Sheen91

    Sheen91 Banned

    Messages:
    579
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The script itself creates tha database, I tried creating the database myself and it works, and then I tried running the script it says the database already exists and it cannot create it.

    I dont think you guys are getting it, You just upload the script and then go back to your site and you see this

    [​IMG]

    You enter in your details and it creates the database for you (ie the one it already has, then your set :D)

    Except it says "Error creating database (Access denied for user 'regalrec'@'localhost' to database 'regalrec_rec'"
    When it tries to create the database
     
    Sheen91, Jul 26, 2008 IP
  5. tsacinc

    tsacinc Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Sheen91,

    These guys are right - those are the first things you look at when importing from a backup - making sure all info is the same.

    You need to open the "backup.sql" file in a text editor and comment out the lines somewhere at the top where it starts with "CREATE".

    You can nullify that SQL statement by adding comment tags to it.. simply add "-- " save and run the import again.

    It should import your data without having to recreate the database.

    Remember your initial problem was "access denied" which you resolved by creating the database. Now you must comment out the "CREATE" statement as noted above.

    Hope this helps,

    Artemis
     
    tsacinc, Jul 28, 2008 IP
  6. Sheen91

    Sheen91 Banned

    Messages:
    579
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Sorry I do not understand???

    I searched my whole (public_html/www) and found no file named "backup.sql"???

    Sorry I have no previous experience with sql.

    Thanks :D
     
    Sheen91, Jul 29, 2008 IP