Go Back   The macosxhints Forums > OS X Help Requests > UNIX - Newcomers



Reply
 
Thread Tools Rate Thread Display Modes
Old 04-25-2003, 07:06 AM   #1
tomsk
Prospect
 
Join Date: Apr 2003
Posts: 14
mySQL - "Access denied for user" message

Ok, I thought I could do it (and have learnt alot in the mean time) but now I'm stumped.

I installed mysql & got it running (I can see it as a process when I type 'top') but..
when i type in:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

I get the following message:
/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'

what have I done or am I missing?

Tom K
tomsk is offline   Reply With Quote
Old 04-25-2003, 08:36 AM   #2
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
Re: mySQL - "Access denied for user" message

Quote:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

I think you want:
Code:
/usr/local/mysql/bin/mysqladmin -u root -p xxx
where xxx is your root password

But it is better to leave off the "-p xxx" and it will prompt you for your password.
hayne is offline   Reply With Quote
Old 04-25-2003, 12:03 PM   #3
tomsk
Prospect
 
Join Date: Apr 2003
Posts: 14
I still get refused

/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'

& its definatly the correct root password I'm using as its works everywhere else.

Tom
tomsk is offline   Reply With Quote
Old 04-25-2003, 12:25 PM   #4
schwartze
MVP
 
Join Date: Dec 2002
Location: NYC
Posts: 1,005
the -p and the password can have no spaces between them.

i.e. -ppassword

give that a try
schwartze is offline   Reply With Quote
Old 04-25-2003, 12:34 PM   #5
grrl_geek
Major Leaguer
 
Join Date: Feb 2003
Location: Berkeley, CA
Posts: 270
Are you trying to log into mysql, or are you trying to change your password?

To change your password (if you already have a password) is

mysqladmin -u <user> -p password <newpassword>

"password" is the word "password", not your current password.

If you don't have a password (i.e., you've just set mysql up), leave the -p off.

If you're trying to log into mysql, do this

mysql -u <user> -p <databasename>

Again, if you've just set mysql up, leave off the -p.

Hope that helps!
grrl_geek is offline   Reply With Quote
Old 04-26-2003, 07:42 AM   #6
tomsk
Prospect
 
Join Date: Apr 2003
Posts: 14
Cheers grrl_geek & everybody,

I couldn't log in & was trying to reset the passord as I think I accidently set a password for mySQL while playing around - I'm completely new to Unix & am only just starting to get my head round it

so...

I thought I might as well start again & used the following comand to unistall mySQL:
sudo rm -r mysql* in cd /usr/local

Then started the whole process again, following instructions given in the package installer 'read me' file & it all seems to have gone ok except... after managing to startup mySQL (& feeling very pleaased with myself!) I shut down the computer & now after starting back up again & restarting mySQL I get this feedback:
Starting mysqld daemon with databases from /usr/local/mysql/data
030426 12:21:24 mysqld ended

Now why on earth has it ended????

Tom (its all turing into an epeic event) K
tomsk is offline   Reply With Quote
Old 04-26-2003, 09:22 AM   #7
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
error log

According to this:
http://www.mysql.com/doc/en/Error_log.html
the error log is in a file ending with the suffix ".err" under your data directory.
Have a look for such a file and tell us what it contains.

One possibility:
Is it possible that you have set it up so that mysql automatically restarts when your computer starts up? If so, then it was already running when you tried to run it manually. That would explain why it would appear to stop right away. You can check if mysqld is running by doing:
ps -auxww | grep mysqld
in a Terminal window.
hayne is offline   Reply With Quote
Old 04-26-2003, 12:17 PM   #8
tomsk
Prospect
 
Join Date: Apr 2003
Posts: 14
BRILLIANT!

you've sussed it hayne, thinking back, I did do something regarding an auto startup - foolish me - but I spose we all have to start somewhere...

I have now managed to log in & have got a connection ID etc.!

Thank you all very much for your help - i'm always impressed when I find a really good forum & this seems to be one.

Tom K

P.S. One last question! I tried to look at the .err file but it won't let me into the data directory - what do I need to do? I tried:
sudo cd data
but:
sudo: cd: command not found
is returned.
tomsk is offline   Reply With Quote
Old 04-26-2003, 02:33 PM   #9
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
sudo

There are only certain commands which 'sudo' allows you to do. 'cd' is not one of them as you found.
If your data directory has permissions that prohibit you (as yourself) from doing 'cd' to it, you could just use 'sudo ls' to see what is in the data directory instead. And then use 'sudo more path/to/the/err/file' to see what is in the err file.
Or, if you really wanted to use the 'cd' route, you could use 'sudo -s' to get a new shell in which you would be root. Use 'exit' to get back to your normal self.
Do 'man sudo' to read more.
hayne is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 10:23 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.