Low Orbit Flux Logo 2 F

Why is It Recommended to Disable Symbolic Links in MySQL

It is recommended to disable symbolic links in MySQL because they can introduce multiple different security risks. The links could potentially point to directories with different permissions that could cause security issues.

This is the line that you will see in the configuration file just above the line that allows you to enable/disable symbolic links:

“Disabling symbolic-links is recommended to prevent assorted security risks”

So long as you are careful you should probably be fine. This isn’t much more dangerous than specifying an alternate data directory. Just make sure your file permissions are managed correctly and you should probably be fine.

Symbolic links can be used to store a database in an alternate location besides the default. You might want your database in a different directory or on a different drive all together. This allows you to do it.

Make sure that you stop the MySQL service before actually moving the directory and creating the link.

You can enable symbolic links for MySQL in the configuration like this:

/etc/my.cnf
symbolic-links=1

You can move a database directory like this:

mv /var/lib/mysql/DBName  /fast_data_drive/DBName
ln -s /fast_data_drive/DBName /var/lib/mysql/DBName

You may run into either permissions issues or selinux issues. Make sure that you are running as the correct user and that all directories are permissioned correctly. You can disable selinux or even potentially configure it correctly if you feel so inclined.