MySQL is the database server where all the data tables are stored.
MySQL is only as vulnerable as your local network security allows. It is not secure to expose the MySQL service to the internet (World Wide Web). Do not open the MySQL port (default is port 3306) on your routers and do not allow incoming traffic for that port. You can open this port as a Firewall exception rule on your servers but NOT on your routers. In simple terms, this means do not open the database to the entire internet, even if you think you are verifying the source IP address: it is not sufficient as IP addresses can be spoofed.
MySQL user names and passwords are a secondary level of security. To access an Open Dental database, you must use a MySQL user and can require a password.
- Putting passwords on MySQL does not solve all security issues. Always ensure your network and server are protected. See Network and Computer Setup.
- MySQL passwords are also not the same as password features built into Open Dental (See Security).
Small offices (users on small closed networks): It is up to you to decide whether or not to set MySQL passwords. We recommend that you do. If someone has access to the data on your server then MySQL passwords do not provide additional protection. Therefore some users may choose to not set MySQL passwords.
Large enterprises should use MySQL users and passwords and create institutional safeguards against losing the password.
Set up the user and password in MySQL
- In the MySQL command line client, run this command to get a list of current users, hosts, and passwords.
SELECT USER, HOST, PASSWORD FROM mysql.user;
A default installation will have 5 users already set up.
- For each user/host combination, run a command to change the password (replace 'new_password' with password). Run each command one at a time.
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'::1' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'%' = PASSWORD('new_password');
SET PASSWORD FOR ''@'localhost' = PASSWORD('new_password');
IMPORTANT: root@% is a completely different than root@localhost. You must change the passwords for both to secure the database from root on all computers.
Consult the MySQL website for details about each user.
By default, root@localhost has global access for MySQL and all privileges are enabled.
- Run the command in step 1 again to confirm the passwords. Each user/host combination should show a hashed version of the password.
- Restart the server, or run the command FLUSH PRIVILEGES;
for the changes to take effect.
Change the user and password on the Choose Database window: After making password changes in MySQL, the Open Dental workstations will no longer have access to the database.
- Close Open Dental on each workstation.
- Restart Open Dental. It will ask for the user and password on the Choose Database window.
- Verify the server and database.
- Verify the user (e.g. root).
- Enter the password just created (for default installations typically the root@localhost password).
The password you enter into the MySQL Configuration window on each computer is stored as obfuscated text in the FreeDentalConfig.xml.
If you plan on hosting multiple customers on the same database server, see Multitenant for isolation information.
You may need to work from particular devices or IP address ranges for multitenant installations or if you have complex networks where some segments should not have access. Open Dental does not provide advice or direct support on setting up usernames for particular devices or network segments.
For multitenant installations, consult an IT professional. For complex networks, consult an IT professional, or for even more security use the Middle Tier. Information about setting up usernames for specific devices or network segments is available at http://dev.mysql.com/doc/refman/5.5/en/account-names.html. Open Dental works fine as long as the specified MySQL user has the correct (full) permission set.
Middle Tier Users
There are two MySQL users that may be specified: a regular user and a user with lower privileges.
- Regular user: Must have all permissions for all tables starting with "opendental" (if that is the name of your database). Must be able to do everything from adding tables to making a backup of the database. It is during the backup process that the user must also have access to a database that might be called "opendentalbackup_07_14_2006", and the user must also have permission to create tables, etc in this other database. Either give this user privileges for all databases or use a wildcard character to give privileges for similar databases.
- UserLow: A user with much lower privileges. No SQL statements are allowed to be passed to the middle tier service except report queries. UserLow is always used for these report queries. This allows prevention of injection attacks at the database level. UserLow should have very limited privileges, just SELECT and CREATE TEMPORARY TABLES, and only for the current database. They will still be able to use queries to select any data, but not
to alter it.
When users connect from the client computers, they will never see or have access to the users that you set up in this file. They will be connecting using an Open Dental username and password. See Choose Database for an example.
If workstations have trouble connecting, it may be a Firewall issue. If you can't get past the Choose Database window, then it's a firewall issue. You may need to create an exception to allow Port 3306. See Open Port 3306. If you've turned off all firewalls on the server and are still stuck at the Choose Database window, see Troubleshooting.
Users and password: If you change passwords and it no longer works, carefully retrace your steps to make sure the new user has all privileges and access to the opendental database. Be aware of the difference between user@% and user@localhost. Double check the privileges and then try again.