Monday 8 April 2019

How to Secure the LAMP Server Database by Raj Gupta

The default installation of the MySQL(MariaDB) server has several features that are great for testing and development, but they should be disabled or removed for production servers. The mysql_secure_installation command walks you through the process of setting a root password and removing the insecure features from your installation.



In my case we using MariaDB(a community-developed fork of MySQL)

1. Start the MariaDB server.
[root@ip-172-31-95-205 ~]# sudo systemctl start mariadb

2. Run mysql_secure_installation.
[root@ip-172-31-95-205 ~]# sudo mysql_secure_installation

Enter current password for root (enter for none):    ---->Just press enter to set new password

Set root password? [Y/n] y      ------> give y to set new password
New password:                    -------> Enter your new password
Re-enter new password:       ------->reenter your new password
Password updated successfully!
Reloading privilege tables..
 ... Success!

Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

If we've completed all of the above steps, our MariaDB installation should now be secure.


No comments:

Post a Comment