LinuxQuestions.org
Visit Jeremy's Blog.
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 08-01-2008, 10:50 AM   #1
soylentgreen
Member
 
Registered: Sep 2004
Location: old village
Distribution: android, BSD, CentOS, Ubuntu
Posts: 221

Rep: Reputation: 30
Unable to reset mysql root password


I have an installation of mysql on a server. Nobody knows the root password, but the server and forum that are operated on it are still up and running. I am trying to reset the root password on the mysql installation, but I am unable to.

This is what I tried:

Code:
# /usr/local/etc/rc.d/mysql-server stop
Stopping mysql.
Waiting for PIDS: 75698.

# mysqld_safe --skip-grant-tables -u mysql &
[1] 75725
Starting mysqld daemon with databases from /var/db/mysql

# mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.1.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> update user set Password=password('password') where User='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
# /usr/local/etc/rc.d/mysql-server stop
Stopping mysql.
Waiting for PIDS: 75746, 75746STOPPING server from pid file /var/db/mysql/mysql.pid
080801 11:45:56  mysqld ended

.
[1]  + Done                          mysqld_safe --skip-grant-tables -u mysql

# /usr/local/etc/rc.d/mysql-server start
Starting mysql.

# mysql -u root -p mysql
Enter password: (I entered the password of 'password')
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I have tried this several times, can someone clue me in as to what I might be doing incorrectly? Why does the "Query OK" line say 0 rows affected?

Thank you for any guidance.
 
Old 08-01-2008, 11:13 AM   #2
Steve K.
LQ Newbie
 
Registered: Jul 2004
Location: Portland, OR
Posts: 15

Rep: Reputation: 1
Chapter 5 in this tutorial discusses MySQL. http://www.beginning-kdevelop-programming.co.uk/ While the tutorial addresses using KDevelop for programming, I found the MySQL discussion very useful.
 
Old 08-01-2008, 01:26 PM   #3
soylentgreen
Member
 
Registered: Sep 2004
Location: old village
Distribution: android, BSD, CentOS, Ubuntu
Posts: 221

Original Poster
Rep: Reputation: 30
Well I read chapter 5, and tried to digest the parts that were applicable to me.

I tried resetting my password with the mysqladmin lines in there, but that is only if you have no password to begin with, or if you know the current password.

mysqladmin with the 'password' function does not appear to work when running in the
mysqld_safe --skip-grant-tables &
mode.
Quote:
mysqladmin:
You cannot use 'password' command as mysqld runs
with grant tables disabled (was started with --skip-grant-tables).
Use: "mysqladmin flush-privileges password '*'" instead

#mysqladmin flush-privileges password '*'
mysqladmin: unable to change password; error: 'Can't find any matching row in the user table'


So I'm still stuck, anyone else have any ideas?

Thanks

Last edited by soylentgreen; 08-01-2008 at 01:30 PM. Reason: added code for mysqladmin command
 
Old 08-02-2008, 09:23 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
I thought that it was an issue with case sensitivity, but I tested it and that does not seem to be the case.

Only difference that I ran it as root, not as user mysql. But doubt very much if that would make a difference.

Last edited by Wim Sturkenboom; 08-02-2008 at 10:02 AM.
 
Old 08-02-2008, 10:03 PM   #5
Steve K.
LQ Newbie
 
Registered: Jul 2004
Location: Portland, OR
Posts: 15

Rep: Reputation: 1
Here's another resource that may more closely address your problem: http://dev.mysql.com/doc/refman/5.0/...rmissions.html
 
Old 08-02-2008, 10:05 PM   #6
Steve K.
LQ Newbie
 
Registered: Jul 2004
Location: Portland, OR
Posts: 15

Rep: Reputation: 1
Sorry about the abbreviated URL It reads .../5.0/en/resetting-permissions.html
 
  


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
mysql: still can't login after root password reset andredude Linux - Software 3 12-27-2012 09:48 PM
MySQL Root Password Reset carlosinfl Linux - Server 6 07-18-2008 03:58 AM
How to retrieve( or reset) root password in Mandrake Linux, as I forgot my password? Reghunath Linux - Software 4 05-08-2008 04:11 AM
mysql root password reset. gtum5 LinuxQuestions.org Member Intro 0 03-08-2007 08:57 PM
MySQL - Canot reset password texmansru47 Linux - Software 1 10-10-2005 05:19 PM


All times are GMT -5. The time now is 03:37 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration