Skip to main content

Posts

Showing posts with the label passwords

How MySQL 5.6 handles passwords more securely

There are many thing changed in MySQL 5.6 which are related to passwords: There is a new password hash algorithm (SHA-256) There is obfuscation for passwords with the .mylogin.cnf file. The option to store slave passwords in a database table. It's now possible to supply a password to START SLAVE. But that's not what this blog post is about. This blog post is a great new feature: Hiding passwords from your log files, automatically. MySQL 5.6 will by default hide passwords from the general log. This is not just obfuscation as only the one-way hash will be put in the log files. By setting log-raw=OFF you can disable password hiding for the general log. The log-raw setting will only influence the general log, so the passwords in the slow query log and the binary logs will still be hidden. With MySQL 5.5 this could be done manually by first storing the hash in a variable, but like many other work-arounds this is not needed anymore. But it doesn't stop there. Accor...

Avoid clear text passwords in MySQL logging.

What happens when you use the PASSWORD() function to insert a password hash into a table? The hash will be written to the table The password might be written in clear text to the binlog The password might be written in clear text to the general log The password might be written in clear text to the slow query log The query mysql [localhost] {msandbox} (test) > INSERT INTO testpwd(pwd) VALUES(PASSWORD(' secret_password ')); Query OK, 1 row affected (0.00 sec) The General log 130128 16:04:41 1 Query INSERT INTO testpwd(pwd) VALUES(PASSWORD(' secret_password ')) The Slow query log # Time: 130128 16:04:41 # User@Host: msandbox[msandbox] @ localhost [] # Query_time: 0.004887 Lock_time: 0.001043 Rows_sent: 0 Rows_examined: 0 SET timestamp=1359385481; INSERT INTO testpwd(pwd) VALUES(PASSWORD(' secret_password ')); The binlog: # at 219 #130128 16:04:41 server id 1 end_log_pos 287 Query thread_id=1 exec_time=0 error_code=0 SET TIMESTAMP=1...