Book Image

Building a Web Application with PHP and MariaDB: A Reference Guide

By : Sai S Sriparasa
Book Image

Building a Web Application with PHP and MariaDB: A Reference Guide

By: Sai S Sriparasa

Overview of this book

Table of Contents (17 chapters)
Building a Web Application with PHP and MariaDB: A Reference Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Securing MariaDB


In this section, we will cover a few topics that will help us secure our MariaDB database server. A few issues that we will cover in this section are:

  • Password-protected access

  • Building views to restrict access

  • Creating users and granting access

Password-protected access

During the MariaDB installation process, the user is normally prompted to enter a password for the root user. It is not required to enter a password; users can hit escape to avoid entering a password. As we are trying to secure the installation, let's go over the steps to protect access by adding a password if the password was not added initially. We will use mysqladmin for this process and enter the following command:

mysqladmin –u root password <userpassword>

In this snippet, we set the new password of the root user. From here on, we will need this password to log in as the root user. Now that we have added the password to the root user, let's log in as the root user and go over the concepts of views...