Solved

Locked out...

Posted on 2004-03-24
6
991 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

778 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