Database Server Setup for MariaDb on Linux¶
1. Install MariaDB server on Ubuntu (20.4)¶
$ sudo apt update $ sudo apt install mariadb-server
2. Ensure that MariaDB is running:¶
$ sudo systemctl start mariadb.service
3. Configuration of the server:¶
$ sudo mysql_secure_installation Enter current password for root (enter for none): <root-password>
4. Checking server's status:¶
$ sudo systemctl status mariadb
5. Install PHP-MyAdmin (optional)¶
$ sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl $ sudo phpenmod mbstring $ sudo systemctl restart apache2
In case the above fails try:
$ sudo apt-get install libapache2-mod-wsgi-py3
6. Adjusting User Authentication and Privileges¶
$ sudo mysql > CREATE USER fwd_admin@localhost IDENTIFIED BY 'admin'; > GRANT ALL PRIVILEGES ON *.* TO fwd_admin@localhost WITH GRANT OPTION;
7. Creating a database with specific collation and character set:¶
> CREATE DATABASE fwd CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
8. Connect with a console and execute the first SQL statements:¶
$ mysql -u fwd_admin -P MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | fwd | | mysql | | performance_schema | | phpmyadmin | +--------------------+ 4 rows in set (0.000 sec) MariaDB [(none)]> use fwd; Database changed MariaDB [fwd]> show tables; +---------------------------+ | Tables_in_fwd | +---------------------------+ | book | | contact | | cust_omers | | customer | [...] +---------------------------+ 49 rows in set (0.000 sec)