How to Insert a MD5 Password (or the Result of Any Other MySQL Function) Into a Field with “Navicat for MySQL”

MySQL already supports MD5() in terms of built-in functions. This is helpful whenever you want to insert something into a cell using the INSERT INTO users (id,username,password_hash) VALUES (1001,john_page,MD5(‘password_here’)) query.

But what happens when you already have a database and you want to change one single cell without fiddling manually with raw SQL queries, especially when you have Navicat SQL GUI software available? Luckily, Navicat has the so-called “Raw Mode” when viewing a table’s rows which allows us to insert data using expressions/functions which will be evaluated and converted to a string as soon as you press ENTER.

Here are the steps to follow if you want to convert a raw string into its MD5 representation and insert that representation as a cell within a MySQL cell:

  1. Open your desired table with Navicat (e.g. “users”)
  2. Choose “View->Raw Mode” from the top menu
  3. In your password field, type the expression, whose result you want inserted in that field, e.g. MD5(‘newpassword’)
  4. Hit “Enter” and “Ctrl+S” to apply the changes. Optionally disable “Raw mode” from the menu if you need to go back to the regular mode.

Enjoy the result of the MD5, without using complex raw SQL queries that are prone to typos.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.