nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Unable to change MySQL password

This is a discussion on Unable to change MySQL password within the Databases servers forums, part of the Mastering Servers category; Hi folks, I followed; MySQL Change root Password to change MySQL password. $ mysqladmin -u root -p oldpassword newpassword Enter ...


Go Back   nixCraft Linux Forum > Mastering Servers > Databases servers

Linux answers from nixCraft.


Databases servers Discussions of databases of all types - especially MySQL.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-04-2009, 10:33 PM
Senior Member
User
 
Join Date: Sep 2007
OS: Debian
Posts: 112
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 3
satimis is on a distinguished road
Default Unable to change MySQL password

Hi folks,


I followed;
MySQL Change root Password

to change MySQL password.

$ mysqladmin -u root -p oldpassword newpassword
Enter password: (enter Mysqladmin Password here)
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'


As root
# mysqladmin -u root -p oldpassword newpassword
Enter password:
mysqladmin: Unknown command: 'MysqladminPassword'


Please help.


B.R.
satimis
Reply With Quote
  #2 (permalink)  
Old 06-04-2009, 10:06 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Are you sure you know the old password?
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #3 (permalink)  
Old 06-04-2009, 10:09 AM
Senior Member
User
 
Join Date: Sep 2007
OS: Debian
Posts: 112
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 3
satimis is on a distinguished road
Default

Quote:
Originally Posted by nixcraft View Post
Are you sure you know the old password?
Hi nixcraft,


YES.


I succeeded changing MySQL root password with following steps;

$ mysql -u root -p
Code:
Enter password: oldpassword
mysql> set password = password("newpassword");
Code:
Query OK, 0 rows affected (0.32 sec)
mysql> quit
Code:
Bye
Then I can login MySQL with newpassword.


I don't know why;
$ mysqladmin -u root -p oldpassword newpassword

did not work?


B.R.
satimis
Reply With Quote
  #4 (permalink)  
Old 06-04-2009, 10:14 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

There is small typo, here is the correct syntax, if:
OLDpassword is abc
Newpassword must be 123456
Then command should be:
Code:
mysqladmin -u root -p'abc' password 123456
You can omit 'abc' and mysql will prompt for the old password:
Code:
mysqladmin -u root -p password 123456
HTH
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #5 (permalink)  
Old 06-04-2009, 10:41 AM
Senior Member
User
 
Join Date: Sep 2007
OS: Debian
Posts: 112
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 3
satimis is on a distinguished road
Default

Quote:
Originally Posted by nixcraft View Post
There is small typo, here is the correct syntax, if:
OLDpassword is abc
Newpassword must be 123456
Then command should be:
Code:
mysqladmin -u root -p'abc' password 123456
You can omit 'abc' and mysql will prompt for the old password:
Code:
mysqladmin -u root -p password 123456
HTH
Hi nixcraft,


$ mysqladmin -u root -p 'abc' password 123456
Code:
Enter password: abc
mysqladmin: Unknown command: 'abc'
It didn't work.

But;
$ mysqladmin -u root -p password 123456
Code:
Enter password: abc
did work. Thanks.


Another question:-
MySQL is running as guest on this Xen box (it can be considered as remote server)

Can I change the root password remotely without ssh-login the server first? (I don't have MySQL running on the host)


B.R.
satimis
Reply With Quote
  #6 (permalink)  
Old 06-04-2009, 11:20 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Quote:
MySQL is running as guest on this Xen box (it can be considered as remote server)

Can I change the root password remotely without ssh-login the server first? (I don't have MySQL running on the host)
Yes.

Only if mysql-networking is configured and root user is allowed to do so... (by default this is disabled)
Code:
 mysqladmin -h remote.server.com -u root -p password 123456
mysqladmin -h 192.168.5.100 -u root -p password 123456
Replace 192.168.5.100 or remote.server.com with actual remote server.
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #7 (permalink)  
Old 06-04-2009, 11:59 AM
Senior Member
User
 
Join Date: Sep 2007
OS: Debian
Posts: 112
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 3
satimis is on a distinguished road
Default

Quote:
Originally Posted by nixcraft View Post
Yes.

Only if mysql-networking is configured and root user is allowed to do so... (by default this is disabled)
Yes, it has been configured.

I must do it in 2 steps

$ ssh remote.server.com

$ mysqladmin -u root -p password newpassword
Enter password: oldpassword

because I don't have mysqladmin running on the host of the Xen box.


Quote:
Code:
 mysqladmin -h remote.server.com -u root -p password 123456
mysqladmin -h 192.168.5.100 -u root -p password 123456
Replace 192.168.5.100 or remote.server.com with actual remote server.
Tried before without success.

$ mysqladmin -h remote.server.com -u root -p newpassword
Code:
bash: mysqladmin: command not found
Also tried as root.

satimis

Last edited by satimis; 06-04-2009 at 12:01 PM.
Reply With Quote
  #8 (permalink)  
Old 06-04-2009, 12:02 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Install mysqladmin command according to your Linux distribution. Also, it can be one command:

Code:
ssh remote.server.com mysqladmin -u root -p password newpassword
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
Reply

Tags
change mysql password command , mysql , mysqladmin , password


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
change password in one go vikas027 HP-UX 0 08-06-2008 02:46 PM
how to change root password sandromax Solaris/OpenSolaris 4 11-10-2007 02:43 AM
Change root password MySQL 5 chiku Databases servers 1 16-01-2007 08:46 PM
HP UX user lock password, change password, password aging rockdalinux HP-UX 0 20-12-2006 02:36 PM
How to Change Password puppen Linux software 6 06-06-2006 01:56 PM


All times are GMT +5.5. The time now is 05:26 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38