Jump to content

MySQL 4.1+ Hashed password recovery


pureless

Recommended Posts

I will pretense this with: I have not lost my password. However, using 4.1+ requires the use of a hashed password. My question, is if i should misplace this long string of random letters and numbers, how would i go about recovering it? It seems a bit inconvenient to require a 10+ character string of random letters to log in. I just wanted to get my answer before the event occurs (which it likely will at some point, with one of my databases). Any advice or pointers on what im missing would be great :)

Edited by pureless
Link to comment
Share on other sites

Are you talking about the password used to access a mysql database? There is no rule regarding how long or complex the password needs to be. Most of my passwords for my development stuff are short and simple.

 

As for recovering a password however, you don't recover it. You just change it by starting the mysqld service with grant tables disabled (ie, authentication disabled) then you update the users table with a new password. Once done restart mysqld as normal and login with the new password. The process is documented in the manual: C.5.4.1. How to Reset the Root Password

Link to comment
Share on other sites

Yes the password to access the database. However you don't get to choose how long or what it is in 4.1+ compatability. You type in your password then hit "generate" which gives you a string of random letters, which is now your database password. Before doing this (when using my standard chosen password), PHP refused to connect with it until the password was updated to the new method. I'm just not fully convinced that i need to have that string of randomness saved in a file with hopes i never lose it...

Link to comment
Share on other sites

You must be using some third-party administration tool which is providing this hashing option, as there is no such thing in the standard mysql stuff. To create a user and give them access to a DB in mysql you just issue a GRANT statement, eg:

grant all on dbname.* to username@hostname identified by 'theirPassword';
You can type whatever value you want in for theirPassword (or leave it out entirely for no password).
Link to comment
Share on other sites

Ya, i connect via phpMyAdmin. When you change a password it has an option to use 4.1+ password hashing which is a larger hash than previous versions used. And below entering your password you hit generate to generate a random string. I was under the impression that was a necessary step and was generated in correspondence to the password you entered. When i tried again without generating this string, i was able to connect with my standard password. Was a simple user error on an assumption i made. Thanks :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.