Take the 2-minute tour ×

I'm a student and we are making a simple information system for a hospital. How can we improve the security of mysql database so that confidential information will be protected.

share|improve this question
Shut down the server—that will make the database impossible to attack. Really: What steps have you taken so far? If we don't know what the current state is how should we know what or how to improve? –  Јοеу Jan 28 '10 at 9:17
You need much more than just protect confidential data. I also work in a hospital, and security is not only limitation of access. You must also take into account high availability (minimize downtime), backup and restore policies, duplicate systems for testing and production, ... This is a too vague question. –  jap1968 Dec 8 '11 at 22:11
add comment

5 Answers

up vote 3 down vote accepted

Security is a complex issue and it is hard to answer vague questions.

A few generalisations.

If it makes sense to co-locate your database and application on the same server, then you should do so and disable all remote access to the database. The downside is that this limits your ability to scale using separate database and application servers.

Also you need to determine if you require replication. If you do then you need to allow access, whereas if you can get away with it you should not.

You need to be rigouous with your username and password regime. I actually use a password generator for both the user name and the password for application access, but how far you go is up to you.

You should assume that someone will get access to your database. Each "user" should only have the permissions required by the user to do that job. The less each user can do the safer you will be when someone does break in. You may need to create several users so each bit of your application can do their job, and only their job.

Lastly you should consider the ramifications of gaining access to your database. I would assume that health records require extremely high levels of security. You may consider some form of encryption / obfuscation in the database itself, but I have not ever needed to do this myself so I cannot comment furher.

share|improve this answer
add comment

Just a few off the top of my head...

  1. Use a good password
  2. Only allow access to the server from places it should be accessed from. eg. if it should only be accessed by a web server on the same machine, then don't allow mysql to be accessed from outside the machine.
  3. Give each person that can access it their own username and password and limit them to only the actions they need to perform. Disable DROP, DELETE etc and don't give average users permission to change databases, create tables, alter tables etc etc.
  4. Make sure you understand the user permissions system used in MySQL. It is a nightmare at first, but gives you a lot of control when you get it.
  5. Don't assume it is secure - it isn't - regardless of what you've done, you can always do more.
share|improve this answer
add comment
  1. use a good password
  2. only allow visitors from certain IP
  3. strong password system, so that even hacked, no one gets it even yourself

md5('your-password') is not secure enough, try something like md5(md5('your-password').'your-password').

share|improve this answer
add comment

Make sure you don't allow SQL Injection from your application.

share|improve this answer
add comment

Disallow connections from all ip addresses except application server ip address. And make sure that application working with DB is free of security holes. :)

share|improve this answer
add comment

Your Answer


