Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have several options:</p> <h2>Option 1: Lazy migration.</h2> <p>Keep both your MySQL and MongoDB servers online and connected. When a user attempts to log in, check the password against MongoDB. If it fails (ie, a password was never set), then check it against MySQL. If it succeeds, then hash the password and store it in the MongoDB document.</p> <p>Downsides: Your MySQL server has to stay online forever (or at least until all your users migrate).</p> <p>Upsides: You can easily replace the MySQL password format with your own format (ie, bcrypt hashes or whatnot). You don't have to have any knowledge of how MySQL is hashing passwords internally.</p> <h2>Option 2: Figure out how the MySQL password() function works, and replicate it clientside.</h2> <p>According to <a href="https://stackoverflow.com/questions/868482/simulating-mysqls-password-encryption-using-net-or-ms-sql">Simulating MySql&#39;s password() encryption using .NET or MS SQL</a> the algorithm MySQL versions 4.1 and greater use for <code>PASSWORD()</code> is <code>"*" + sha1(sha1("password"))</code>, more or less. If you're running an older version, you'll need to find out what the hashing algorithm is, and use it instead. You can just take your password, double SHA1-hash it, prepend an asterisk, and check to see if that value matches what's in the DB.</p> <p>Downsides: The exact algorithm depends on the version of MySQL you're running, so you might have to do a bit of digging depending on your MySQL version. You're still stuck using the MySQL password format in your MongoDB documents (though you could do a lazy upgrade, with a procedure similar to what was described in option 1).</p> <p>Upsides: You can do the migration once and then take your MySQL server offline.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload