#Storing Data with MariaDB
#Prerequisites
- A firewall rule to accept traffic on TCP port 3306 has been added
- If using a virtual machine, port 3306 is forwarded
#Install MariaDB
#Create a Database and a User
Log in as the root system user.
Create a database for your web application.
Create a user to represent your web application.
Replace [username]
and [password]
with the actual credentials you want your web applications to use when they authenticate to the database.
The %
means that the user can connect from any IP address. Replace it with localhost
to only allow local connections or replace it with an IP address to only allow connections from that IP address.
Grant database privileges to this user.
The same warning as above applies to this %
.
Apply the privilege changes.
Exit the MariaDB REPL.
#Allow Remote Connections
Edit /etc/mysql/my.cnf
.
Add the following lines at the end of the file.
Save and close the file.
Restart the database service.