Installing MySQL

1 min read
On this page MySQL (MariaDB) - a free relational database management systemOpening the database from external sources:

MySQL (MariaDB) - a free relational database management system

To start, update the system's package and repository lists:

sudo apt-get -y update && sudo apt-get -y dist-upgrade

Add the MariaDB repository:

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

Install MariaDB:

sudo apt-get -y install mariadb-server

Next, activate the program using the following command:

mysql -u root -p

The ";" symbol is mandatory in SQL queries!

Select MySQL:

USE mysql;

Create the first user:

CREATE USER 'myfirstdb'@'localhost' IDENTIFIED BY '123456';

Now, create a Database:

CREATE DATABASE server;

Using two commands, grant the user access to the Database:

    GRANT ALL PRIVILEGES ON server.* TO 'myfirstdb'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Opening the database from external sources:

If you need to connect to MySQL from outside localhost, you should edit /etc/mysql/my.cnf, find the bind-address line, and make it look like this:

#bind-address = 127.0.0.1

Restart MySQL:

service mysql-server restart
Didn’t find the answer?Contact support — we’ll help you sort it out.
Open a ticket →