Results 1 to 11 of 11

Thread: Cannot create database{MySql}

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Cannot create database{MySql}

    Ive been tinkering with MySql and everytime i try to create a database using sql i get an error in dos. ERROR 1044: Access denied for user: '@localhost' to database 'whatever the database name is '

    How can acccess be denied when i haven't even created the database yet.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    If MySQL security is anything like SQL Server then your server login has not been granted permissions to create databases.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    In your connection string, is root your username?

    The default in MySQL is username: root with a blank password.

  4. #4

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Posted by mendhak
    In your connection string, is root your username?

    The default in MySQL is username: root with a blank password.
    Im trying to create the database from dos but i don't understand what dos trying to tell me. It's saying that access is denied to the database when i haven't even created it yet.

  5. #5

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    I found this in a mysql reference manual. So this should fix it.

    Access denied for user error

    If you attempt to run a MySQL client program to connect to a server running on the same machine, but get the error Access denied for user: 'some-user@unknown' to database 'mysql', this means that MySQL cannot resolve your hostname properly. To fix this, you should create a file named `\windows\hosts' containing the following information:

    127.0.0.1 localhost

  6. #6

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    No, it'll be a file named hosts without an extension.

    Just like in

    C:\WINNT\system32\drivers\etc

  8. #8

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    I saved 127.0.0.1 localhost in notepad which i named hosts which has the path C:\WINDOWS\hosts with no extension but this still dosen seem to help.

  9. #9

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    This version(and probably others) allowme to connect as an anonymous user to the server running on local host.

    I ran mysql> select user(); and it came upODBC@localhost so i don't think it's a connection issue.

    Maybe need to be granted privileges to create databases? Can i use the following or is this just used when you want to access a db that already exists?
    Code:
    mysql> GRANT ALL ON menagerie.* TO 'your_mysql_name'@'your_client_host';

  10. #10

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Ah forget it. Ill just use the db that comes with mysql for now. C:\mysql\data\test If anyone still knows what i can do please still post.

  11. #11
    Addicted Member
    Join Date
    Jan 2006
    Location
    Osaka
    Posts
    200

    Re: Cannot create database{MySql}

    I know this is two years old thread.
    But i am having same problem...
    Windows XP and mysql 4.1 ... How to solve ^^ same error.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width