Solved

Locked out...

Posted on 2004-03-24
6
986 Views
Last Modified: 2012-06-27
I set a root pw for mysql after setting it up on a server.  Since then I'm locked out as root.  Is there anyway to fix this without reinstalling mysql?
0
Comment
Question by:source2k3
  • 4
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
vanekl earned 500 total points
ID: 10668540
0
 
LVL 1

Author Comment

by:source2k3
ID: 10669122
Hmm, first following the instructions, I found the pid in
/var/run/mysqld/mysql.pid

but when typing the command as the guide shows:
kill 'cat /var/run/mysqld/mysql.pid' I get no such pid.

Soo...I killed the pid manually with the numeric pid shown in ps aux.

I then tried using the command shown in the guide to restart the server:

mysqld_safe --skip-grant-tables &

It said mysqld_safe is an unknown command...

So I used service mysqld start --skip-grant-tables &
which appeared to work...

I then tried to follow the next step which was to type

mysqladmin -u root flush-privileges password "newpwd"

This gave me the error:

ERROR 1044: Access denied for user: '@localhost' to database 'mysql'


Help? :(
0
 
LVL 6

Expert Comment

by:vanekl
ID: 10669423
What version of mysql are you using?
The mysqld_safe script may also be called safe_mysqld, and it may either be in the mysql/bin
directory or the mysql/scripts directory. It would make things easier if you used this script.

The reason why mysqld start --skip-grant-tables didn't appear to work is because the --skip-grant-tables
option was probably ignored since 'start' is not a valid option. You should use,

mysqld_safe --skip-grant-tables

or

safe_mysqld --skip-grant-tables
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 1

Author Comment

by:source2k3
ID: 10674074
Okay, reversing it like you suggested worked...kinda.

typing
safe_mysqld --skip-grant-tables
gives me:
Starting mysqld daemon with databases from /var/lib/mysql
then it just sits there without bringing me back to a shell prompt or anything.

If I open another ssh session I can see that mysqld is running on the process list, but it won't give me access to reset the permissions.

Man this is frustrating.
0
 
LVL 1

Author Comment

by:source2k3
ID: 10674129
Okay, I was missing the & at the end of safe_mysqld --skip-grant-tables &.

I was then able to issue the flush privileges command and it appears to work, but it then gives me:
ERROR 1044: Access denied for user: '@localhost' to database 'mysql'

Why is it giving a blank instead of the @?  Shouldn't it say root there?

I'm really not an idiot....I promise....
0
 
LVL 1

Author Comment

by:source2k3
ID: 10674486
Okay, you can disregard.  

I said f*** it and just uninstalled mysql completely, and reinstalled it.  It's all set now.

Thanks for trying to help though.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now