LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-18-2003, 08:22 AM   #1
jon_k
Member
 
Registered: Jul 2003
Location: Fort Worth, Texas
Distribution: Mepis Linux 2004
Posts: 547

Rep: Reputation: 30
Question MYSQL root password forgotton


My old post seems to have been deleted... dunno why..


Well I found the following on google telling you how to reset it
18.9 How to reset a forgotten password. If you have forgotten the root user password for MySQL, you can restore it with the following procedure. Take down the mysqld server by sending a kill (not kill -9) to the mysqld server. The pid is stored in a .pid file which is normally in the MySQL database directory: kill `cat /mysql-data-directory/hostname.pid` You must be either the UNIX root user or the same user the server runs as to do this. Restart mysqld with the --skip-grant-tables option. Connect to the mysqld server with mysql -h hostname mysql and change the password with a GRANT command. See section 7.26 GRANT and REVOKE syntax. You can also do this with mysqladmin -h hostname -u user password 'new password' Load the privilege tables with: mysqladmin -h hostname flush-privileges or with the SQL command FLUSH PRIVILEGES.

So... I took down the sqld

But then I couldn't find a way to restart it with --skip-grant-tables ..... I looked at the --help for mysql and mysqladmin ... nothing like that caught my eye


NOW...

Once I get all the above figured out thus far...

when I connect to the mysql with
"mysql -h hostname"

Since my box often says stuff like localhost.localdomain will I do a mysql -h localhost.localdomain
or do
mysql -h mydomain.org........?
(i'm guessing localhost.localdomain)

then that's when I type GRANT <my desired new pass> ?

thanks for clearing my confusion... I feel like a real idiot... and I'm embarassed...

I seem to be posting here alot... because it's the quickest way to get help and also the people here are the friendliest... hopefully when I become really slick with Linux... I can help peope in my position on these forums one day too...

linuxquestions has become a shrine for me...
Thank you!

Last edited by jon_k; 07-18-2003 at 08:33 AM.
 
Old 07-18-2003, 01:35 PM   #2
gabriele_101
Member
 
Registered: Oct 2001
Location: CAMBRIDGE, MA USA
Distribution: RH9 Kernel 2.4.20-18.9
Posts: 69

Rep: Reputation: 15
Try this as root:

shell>service mysql stop
shell>safe_mysqld --skip-grant-tables &
shell>mysql -u root
mysql>use mysql;
mysql>UPDATE user SET Password=PASSWORD('foo!bar') WHERE User = 'root';
mysql>FLUSH PRIVILEGES;
mysql>exit;
shell>kill %1
shell>service mysql start

Don't copy the "shell>" and "mysql>" prompts, those are for reference only. Don't know why they make the instructions so complicated sometimes

-G
 
Old 07-18-2003, 01:38 PM   #3
gabriele_101
Member
 
Registered: Oct 2001
Location: CAMBRIDGE, MA USA
Distribution: RH9 Kernel 2.4.20-18.9
Posts: 69

Rep: Reputation: 15
BTW, "-h localhost" should work just fine. I tried following their instructions after my post and mysqladmin refused to let me update the password, but mysql worked just fine. I suggest making sure that there be only one entry for root in the user table and that the Host be localhost, but that's just me.

-G
 
Old 07-18-2003, 02:29 PM   #4
jon_k
Member
 
Registered: Jul 2003
Location: Fort Worth, Texas
Distribution: Mepis Linux 2004
Posts: 547

Original Poster
Rep: Reputation: 30
in reply to gab's post

mysql> UPDATE user SET Password=PASSWORD('damn*sql') WHERE User='root';
Query OK, 2 rows affected (0.04 sec)
Rows matched: 2 Changed: 2 Warnings: 0

mysql> FLUSH PRIVILAGES;
ERROR 1064: You have an error in your SQL syntax near 'PRIVILAGES' at line 1

Last edited by jon_k; 07-18-2003 at 02:38 PM.
 
Old 07-18-2003, 03:46 PM   #5
gabriele_101
Member
 
Registered: Oct 2001
Location: CAMBRIDGE, MA USA
Distribution: RH9 Kernel 2.4.20-18.9
Posts: 69

Rep: Reputation: 15
That's privilEges not privilAges

In any case, killing safe_mysqld with a simple kill %1 as mentioned earlier should flush tables for you so you don't really need to do it from within mysql.

-G
 
Old 07-18-2003, 08:09 PM   #6
jon_k
Member
 
Registered: Jul 2003
Location: Fort Worth, Texas
Distribution: Mepis Linux 2004
Posts: 547

Original Poster
Rep: Reputation: 30
OK... i got it.... great... thanks
 
  


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
DISCUSSION: MySQL root password recovey Boby LinuxAnswers Discussion 1 02-19-2009 01:51 PM
mysql root password lost nazir Linux - Software 6 10-09-2007 10:18 AM
MySQL root password. bulzbb Linux - Newbie 2 03-11-2004 09:32 AM
Resetting MySQL root password b200306 Linux - Software 3 02-08-2004 03:21 PM
Mysql root password spintrance7 Linux - Software 7 11-29-2003 04:20 PM

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

All times are GMT -5. The time now is 08:36 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