Installing and configuring MySQL (MariaDB)
MySQL is a free relational database management system.
First, update the system package and repository lists:
bash
sudo apt-get -y update && sudo apt-get -y dist-upgradeAdd the MariaDB repository:
bash
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bashInstall MariaDB:
bash
sudo apt-get -y install mariadb-serverNext, start the client using the following command:
bash
mysql -u root -pThe ";" character is required in SQL queries.
Select the MySQL system database:
sql
USE mysql;Create the first user:
sql
CREATE USER 'spacecore'@'localhost' IDENTIFIED BY '123456';Now create a database:
sql
CREATE DATABASE server;Use the following two commands to grant the user access to the database:
sql
GRANT ALL PRIVILEGES ON server.* TO 'spacecore'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;#Opening the database for external access
If you need to connect to MySQL from a host other than localhost, edit /etc/mysql/my.cnf and find the bind-address line so that it looks as follows:
ini
#bind-address = 127.0.0.1Restart MySQL:
bash
service mysql-server restartDid not find the answer? We are online 24/7.Contact support