i am using command line to create my database.
when i key in

mysqladmin -u dba_user -p create drupal

it prompts me to enter password. i leave it blank and hit enter.

it show this error

mysqladmin: CREATE DATABASE failed; error: 'Access denied for user: '@localhost'
to database 'drupal''

When i enter other password it show this error

mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'dba_user@localhost' (Using password: YES)'

i am a newbie can anyone help me
thanks in advance...

Comments

pobster’s picture

When you installed mysql you needed to create a password for the root user. You've either not set it, or you've forgotten what you've set it to ;o) On my system I set it the same as my log in password so that I don't forget it. If you haven't set it at all, you'll be able to type this:

mysqladmin -u root password mypassword (obviously don't take that literally! Change 'mypassword' into your password!)

There's some instructions on setting up mysql here:

http://www.gentoo.org/doc/en/mysql-howto.xml

I like Gentoo :o) Many wiki :o)

Pobster

titus14’s picture

i try to change the root password. but the same error appeared again

morisy’s picture

Just wanted to say thanks ... I just had this problem and pobsters tip helped me fix my installation on Mac OS X after hours of befuddlement.

battaglia’s picture

hi!i have the same broblem with Titus14, but i use ubuntu!
this: mysqladmin -u root password mypassword, doesn't work.
i get this error: mysqladmin:connect to server at 'localhost' failed AND
access denied for user: 'root@localhost' (using password:NO)
what should i do to create a new database?
thank you

pobster’s picture

Your syntax is wrong, it's -ppassword not just your password. See the error message says you've not used a password? That's why!

Pobster

pobster’s picture

What operating system are you using? Could point you towards a wiki for your system...?

Pobster

titus14’s picture

the operating system i work on is windows xp pro

pobster’s picture

The same error message appeared because you've already set the root user password but you have forgotten what it is ;o) Fortunately you can reset it, there's a guide here:

http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

Hope this helps!

Pobster

titus14’s picture

thanks alot pobster.. i finally managed to create the database but now i have a new prob..

when i m setting the path to the druapl database i can't seem to find the file conf.php in the directory. i m using drupal 4.6.3. i tried to search for it in other directory but i still not able to find it ... can u give me some advice..
thanks

pobster’s picture

What instructions are you using that tell you to find conf.php? I don't think Drupal even has a conf.php?!!! Mind you, it's been a very long time since I did an install so I could have just forgotten... The path you set for Drupal in settings.php isn't even really a path, it's an address which resolves to your webserver (whether it's local - localhost, an IP address - 192.168.0.1 or a FQDN - www.mysite.com). The only other paths you have to set are actually in Drupal and are for your files/ and /tmp directories.

Pobster

titus14’s picture

the instruction i using is from this website

http://drupal.org/book/export/html/5438

the part that i m having problem is under the sub-topic called "Connecting it All Together"

now when i type localhost/drupal on address bar it have this problem

Warning: mysql_connect(): Access denied for user: 'username@localhost' (Using password: YES) in C:\www\drupal\includes\database.mysql.inc on line 31
Access denied for user: 'username@localhost' (Using password: YES)

oh mine getting more n more messy

pobster’s picture

Okay it's making more sense now ;o) The instructions you're using are VERY OLD. Don't use them! Use the INSTALL instructions in the tarball/ zip file you downloaded. Report back...!

It still seems you are having trouble with your password for mysql? Did you set a root users password? Can you log into mysql using this password? Did you remember to log in AS ROOT and grant access to your Drupal database for your local database user? Did you set that user a password?

Report back! :o)

Pobster

titus14’s picture

thanks pobster i have sucessfully installed drupal.. thanks for ur help man.

ax’s picture

so that nobody else falls into this trap

battaglia’s picture

so what should i write exacly to create a new root account?

pobster’s picture

Try typing this;

nano -w INSTALL.mysql.txt

Yeah I'm sure that'll help...

Pobster

QingZi’s picture

hi guys, i am having the exact same problem. i am very sure i entered my own sql root password during installation which is the same as my account login password. however, i too am facing the same problem. keeps getting me access denied. i tried running the command both in sudo and normal usage and both gives me access denied.

any ideas? i am using ubuntu server 8.04.1

pobster’s picture

An important thing to note is that error messages generally don't lie (unless perhaps you're using Windows...) The fact that you're getting an access denied error means it's evident that you're doing something wrong which is password related... If the error contains something along the lines of "...using password: YES" then, yes - you've just forgotten what your password is so just reset it. If that error contains "NO" then your syntax is wrong (things do change, in fact - yes, things have changed since the start of this thread) refer to the INSTALL files in the root of your website directory.

Pobster

Orna N’s picture

I seem to be getting the same error, but I'm certain I'm using the right password.
I just set up the root user account, have been able to mysql via the command line and view the database, change the details etc, but then when I try to use those same details to configure the database as part of the set up, I get "access denied" errors.

I've tried setting up new users/databases but noe of those work either.

I'm really at a loss,
Thanks!

pobster’s picture

Wow this is an old thread! Ummm okay... Does it work when you use the root/ admin mysql account? Have you tried creating your own settings.php file and doing it manually?

Pobster