Book Image

MariaDB Cookbook

By : Daniel Bartholomew
Book Image

MariaDB Cookbook

By: Daniel Bartholomew

Overview of this book

Table of Contents (20 chapters)
MariaDB Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Securing MariaDB files on Linux


Filesystem security is an important part of keeping the data in our databases safe. This is because MariaDB, like most programs, stores the data it handles in files on our filesystem. If those files can be read and copied by anyone who can log in to the server, then there's nothing stopping them from making a copy of those files and then accessing them with MariaDB on another server. This recipe is about securing our files on Linux.

Getting ready

Prior to starting this recipe, use the package manager to install the tree program.

On Fedora, Red Hat, or CentOS, run the following command:

sudo yum install tree

On Debian or Ubuntu, run the following command:

sudo apt-get install tree

How to do it...

  1. Open a terminal window and run the following statements:

    sudo tree -puga /usr/lib*/mysql /lib*/mysql \
      /etc/mysql* /etc/my.cnf* /var/lib*/mysql
    
  2. Stop MariaDB if it is running.

  3. Change the ownership of all files that are not owned by either the root or mysql users to whichever...