LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-06-2009, 04:26 PM   #1
timiao
LQ Newbie
 
Registered: Nov 2009
Posts: 2

Rep: Reputation: 0
How to fix "mysqladmin: connect to server at 'localhost' failed"?


Hi all,
I can log in Mysql database successfully using
Code:
mysql -u myusername -p mypassword
. Now, I need to execute GRANT PRIVILEGES. But, when I try to execute
Code:
mysqladmin -u myusername password mypassword
the below error occured

mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'myusername'@'localhost' (using password: NO)'


Any help will be appreciated! Thank you all!
 
Old 11-06-2009, 04:33 PM   #2
wfh
Member
 
Registered: Sep 2009
Location: Northern California
Distribution: Ubuntu Debian CentOS RHEL Suse
Posts: 164

Rep: Reputation: 44
Quote:
Originally Posted by timiao View Post
Code:
mysqladmin -u myusername password mypassword
the below error occured

mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'myusername'@'localhost' (using password: NO)'
You should say:

Code:
mysqladmin -u myusername  -p
...and type the password when prompted. If you don't want to type the password, consider creating an "my.cfg" file. In your home directory, create a file called ".my.cnf" and add the following:

Code:
[client]
user = <myusername>
password = <mypassword>
...where of course, you substitute your user name and password. Be sure to limit access to that file with:

Code:
chmod 600 .my.cnf
Try not to type your password in your command-line instructions (it's okay to use "-p"), since you are storing it in history. Someone might be able to harvest your password from .bash_history : (

Last edited by wfh; 11-06-2009 at 04:41 PM.
 
Old 11-06-2009, 04:51 PM   #3
timiao
LQ Newbie
 
Registered: Nov 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by wfh View Post
You should say:

Code:
mysqladmin -u myusername  -p
Thanks for your reply,wfh.

I ever tried
Code:
mysqladmin -u myusername -p
But there is no promotion there, such as "password:". Something about help just like below appeared,

[root@grid1 ~]# mysqladmin -u myusername -p
mysqladmin Ver 8.41 Distrib 5.0.45, for redhat-linux-gnu on i686
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Administration program for the mysqld daemon.
Usage: mysqladmin [OPTIONS] command command....
-c, --count=# Number of iterations to make. This works with -i
(--sleep) only.
-#, --debug[=name] Output debug log. Often this is 'd:t,filename'.
..........
..........
start-slave Start slave
stop-slave Stop slave
variables Prints variables available
version Get version info from server


Any suggestion?
 
Old 11-07-2009, 09:39 PM   #4
wfh
Member
 
Registered: Sep 2009
Location: Northern California
Distribution: Ubuntu Debian CentOS RHEL Suse
Posts: 164

Rep: Reputation: 44
Quote:
Originally Posted by timiao View Post
I ever tried
Code:
mysqladmin -u myusername -p
Any suggestion?
It is probably better to get into a mysql shell

Code:
mysql -u root -p
...and issue the GRANT from there. Use this as a guide, perhaps.
 
Old 11-07-2009, 10:16 PM   #5
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
try using the -p
Code:
mysqladmin -u root -p <your old password> password "<you new password>"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysqladmin: connect to server at 'localhost' failed... bluetxxth Fedora 4 10-07-2007 10:42 AM
Trying webmin, getting "attempt to connect to 127.0.0.1:10000 (localhost) failed" jeffreybluml Linux - General 1 08-16-2007 11:16 AM
samba/swat: can't connect to "http://localhost:901/" bioe007 Slackware 5 06-05-2007 11:14 AM
KDE Error "Conversation with su failed" SuSE 10.2 Fix jdmcdaniel3 SUSE / openSUSE 4 05-24-2007 06:20 AM
mysqladmin localhost pass failed tommytomato Linux - Newbie 9 08-15-2004 07:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration