LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-06-2007, 07:30 AM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
Lost of mysql root password


Hi folks,


Ubuntu 7.04 server amd64
mysql-server 5.0.38
mysql-admin 1.2.5rc-1
mysql-admin-common 1.2.5rc-1
mysql-client 5.0.38
libmysqlclient15-dev 5.0.38

$ sudo mysql -u root mysql
Code:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Please advise how to recreate new mysql root password w/o the old password? TIA


B.R.
satimis
 
Old 12-06-2007, 07:45 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
You didn't pass a password to it. If you don't know your password, restart mysql with the --skip-grant-tables switch, reset or create new password for root, then restart again without the --skip-grant-tables

If you do know the old password, try running:

mysql -uroot -p mysql

And let it prompt for the password, or pass it with --password=<password>
 
Old 12-06-2007, 08:43 AM   #3
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by trickykid View Post
You didn't pass a password to it. If you don't know your password, restart mysql with the --skip-grant-tables switch, reset or create new password for root, then restart again without the --skip-grant-tables
Thanks for your advice.

Tried some suggesions found on googling w/o result.


Performed test;

# /etc/init.d/mysql stop
Code:
 * Stopping MySQL database server mysqld                                    [ OK ]
# /etc/init.d/mysql start --skip-grant-tables
Code:
 * Starting MySQL database server mysqld                                    [ OK ] 
 * Checking for corrupt, not cleanly closed and upgrade needing tables.

# mysql -u root password myrootpassword
Code:
mysql  Ver 14.12 Distrib 5.0.38, for pc-linux-gnu (x86_64) using readline 5.2
Copyright (C) 2002 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
Usage: mysql [OPTIONS] [database]
  -?, --help          Display this help and exit.
......
......
column-names                      TRUE
sigint-ignore                     FALSE
port                              3306
prompt                            mysql> 
quick                             FALSE
raw                               FALSE
reconnect                         TRUE
socket                            /var/run/mysqld/mysqld.sock
ssl                               FALSE
ssl-ca                            (No default value)
ssl-capath                        (No default value)
ssl-cert                          (No default value)
ssl-cipher                        (No default value)
ssl-key                           (No default value)
ssl-verify-server-cert            FALSE
table                             FALSE
debug-info                        FALSE
user                              root
safe-updates                      FALSE
i-am-a-dummy                      FALSE
connect_timeout                   0
max_allowed_packet                16777216
net_buffer_length                 16384
select_limit                      1000
max_join_size                     1000000
secure-auth                       FALSE
show-warnings                     FALSE

# mysql -u root -p
Code:
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Still failed.


Eversince I accidentally removed /home/satimis previously some problem popup. Whether I have to remove mysql-server and reinstall it? Would it affect other packages. The mail server is now running w/o problem including SquirrelMail, the webmail.


TIA


B.R.
satimis
 
Old 12-06-2007, 09:04 AM   #4
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
http://dev.mysql.com/doc/refman/5.0/...rmissions.html
 
Old 12-06-2007, 09:59 AM   #5
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi folks,


Problem solved following;

Recover MySQL root password
http://www.cyberciti.biz/tips/recove...-password.html


Thanks


satimis
 
Old 12-06-2007, 12:30 PM   #6
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by satimis View Post
Hi folks,


Problem solved following;

Recover MySQL root password
http://www.cyberciti.biz/tips/recove...-password.html


Thanks


satimis
Yeah, I'm kind of confused on why you would try passing a password as:

mysql -u root password mypassword

Did you not read my instructions:

mysql -u root -p mysql --password=password

It kind of needs the -- and = when specifying the password.

You can also do:

mysql -uroot -p<password> without a space and it will work but I don't recommend this. Anyone that gains access to your server can see your mysql password in your history.
 
Old 12-06-2007, 09:05 PM   #7
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by trickykid View Post
Yeah, I'm kind of confused on why you would try passing a password as:

mysql -u root password mypassword

Did you not read my instructions:

mysql -u root -p mysql --password=password

It kind of needs the -- and = when specifying the password.

You can also do:

mysql -uroot -p<password> without a space and it will work but I don't recommend this. Anyone that gains access to your server can see your mysql password in your history.
Hi trickykid,


Sorry I haven't finished trying your second suggestion. On running;
Code:
# mysql -u root -p mysql
It popup for password. The old password can't work. I don't why. So I stopped there.


satimis
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql root password lost nazir Linux - Software 6 10-09-2007 10:18 AM
root password lost odexut7 Fedora 2 01-18-2006 02:18 PM
lost mysql password, can't recover slackhack Linux - Software 1 12-03-2005 05:15 PM
lost root password thick_guy_9 Slackware 2 03-07-2005 08:35 AM
Lost root password Nectalathiel SUSE / openSUSE 2 12-26-2004 01:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

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