.Net Core | C# | Linux

Results for Linux, 1 results

How To Install MariaDB on Ubuntu

Asked 1 year 9 months 15 days 22 hours 27 minutes ago, Viewed 711 times

MariaDB is an open source database management system widely used as an alternative to MSSQL. You can use it as a database for connecting to Net Core applications. It's best to install it on a free Ubuntu server.

Installing MariaDB

In the ubuntu console, enter the commands:

console:
sudo apt update
sudo apt install mysql-server mysql-client
sudo apt install mariadb-server mariadb-client
sudo systemctl start mariadb.service

Configuring MariaDB

Next you have to change the bind address of MariaDB. Edit the required configuration file
/etc/mysql/mariadb.conf.d/50-server.cnf
Once you do find the line, comment out the line (by putting a # at the beginning of the line).

/etc/mysql/mariadb.conf.d/50-server.cnf
#bind-address = 127.0.0.1

Next step is to run the included security script. This script changes some of the less secure default options.
We will use it to block remote root logins and to remove unused database users.

console:
sudo mysql_secure_installation

Creating New User MariaDB

Now, in order to access MariaDB remotely, you have to create at least one MariaDB database user with remote access privileges. If you’re using an existing MariaDB server, then it may have root password set. To do that, login to the MariaDB database console as root with the following command.

console:
sudo mysql

By default, MariaDB server has no root password set. In that case, you can login to the MariaDB console as follows:

console:
sudo mysql -u root -p

Now, we will create a new user with root privileges and password-based access in the MariaDB shell. Change the username and password to match your preferences:

MariaDB[(none)]> GRANT ALL ON *.* TO '_admin'@'%' IDENTIFIED BY '_password' WITH GRANT OPTION;

Flush the privileges to ensure that they are saved and available in the current session.

MariaDB[(none)]> FLUSH PRIVILEGES;

Following this, exit the MariaDB shell.

MariaDB[(none)]> exit

Testing MariaDB

When installed from the default repositories, MariaDB should start running automatically. To test this, check its status.

console:
sudo systemctl status mariadb

You’ll receive output that is similar to the following:

console:
netcoremvc-app.service
     Loaded: loaded (/etc/systemd/system/netcoremvc-app.service; enabled; preset: enabled)
     Active: active (running) since Thu 2023-02-23 10:48:28 GMT; 5h 29min ago
   Main PID: 1240471 (run_netcode.sh)
      Tasks: 21 (limit: 9268)
     Memory: 170.2M
        CPU: 29.664s
     CGroup: /system.slice/netcoremvc-app.service
             ├─1240471 /bin/sh /home/rafal/Project/app/run_netcode.sh
             └─1240472 ./NetCode --urls=https://0.0.0.0:5001

Feb 23 10:48:32 bmax-rafal run_netcode.sh[1240472]: info: Microsoft.Hosting.Lifetime[0]
Feb 23 10:48:32 bmax-rafal run_netcode.sh[1240472]:       Application started. Press Ctrl+C to shut down.
Feb 23 10:48:32 bmax-rafal run_netcode.sh[1240472]: info: Microsoft.Hosting.Lifetime[0]
Feb 23 10:48:32 bmax-rafal run_netcode.sh[1240472]:       Hosting environment: Production
Feb 23 10:48:32 bmax-rafal run_netcode.sh[1240472]: info: Microsoft.Hosting.Lifetime[0]

Start, stop & restart MariaDB server in Linux

When installed from the default repositories, MariaDB should start running automatically. To test this, check its status.

console:
systemctl enable mariadb
systemctl start mariadb
systemctl stop mariadb
systemctl restart mariadb

Edit data and structures MariaDB

For windows, I recommend the HeidiSQL application to manage the mariaDB database.
HeidiSQL is free software, and has the aim to be easy to learn. "Heidi" lets you see and edit data and structures from computers running one of the database systems MariaDB, MySQL, Microsoft SQL, PostgreSQL and SQLite. Invented in 2002 by Ansgar, HeidiSQL belongs to the most popular tools for MariaDB and MySQL worldwide. Link to HeidiSQL


<<How to connect to mariaDB database>>