How do I keep a mySQL database secure?

You should think long and hard about whether you REALLY need to keep the CC#. If you don't have a great reason, DON'T! Every other week you hear about some company being compromised and CC#'s being stolen. All these companies made a fatal flaw - they kept too much information. Keep the CC# until the transaction clears. After that, delete it.

As far as securing the server, the best course of action is to secure the hardware and use the internal system socket to MySQL, and make sure to block any network access to the MySQL server. Make sure you're using both your system permissions and the MySQL permissions to allow as little access as needed. For some scripts, you might consider write-only authentication. There's really no encryption method that will be foolproof (as you will always need to decrypt, and thus must store the key). This is not to say you shouldn't - you can store your key in one location and if you detect system compromise you can destroy the file and render the data useless.


MySQL, there is six easy steps you can do to secure your sensitive data.

Step 1: Remove wildcards in the grant tables

Step 2: Require the use of secure passwords

Note: Use the MySQL “--secure-auth” option to prevent the use of older, less secure MySQL password formats.

Step 3: Check the permissions of configuration files

Step 4: Encrypt client-server transmissions

Step 5: Disable remote access

Step 6: Actively monitor the MySQL access log

Security Tools