Solved

Locked out...

Posted on 2004-03-24
6
994 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Insert values are dynamic 11 71
migrating to phpbb forum from vBulletin 4.2 3 97
MySQL HA and DR solution. 5 38
Undefined variable with $_POST in PHP 5 40
Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

751 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