From Mageia wiki
Jump to: navigation, search
Drakconf multiflag.png
Other languages

English ; Français


Introduction

Databases are used to manage large amounts of similar structured data, like information about clients (first name, family name, 1st line of address, 2nd line of address, zip code, city etc.), clothes (type, brand, price, size, description, number in stock etc.), purchases etc.. Databases mainly consist of tables, relationships between tables and "queries", i.e. ways to extract from the data exactly the information you need for a particular purpose, for instance "all trousers priced more than 50 € bought by clients living in Paris in 2014, with just their price and size".

MariaDB is a database management system using a language called SQL and included in Mageia. It is a fork of MySQL, so it often uses file and folder names including "my" or "mysql" in them. In Mageia, the configuration file is /etc/my.cnf and the databases are stored in /var/lib/mysql. Databases are not human-readable files and MariaDB doesn't include a GUI (graphic user interface). A good way to read and manage MariaDB data is PhpMyAdmin. Many applications use MariaDB to manage their data, without the final user having to know it at all.

Installation

In most cases, you will need a LAMP (Linux, Apache, MariaDB, PHP) pile, plus PhpMyAdmin. To install them, go to Mageia control center (an icon in the tool bar usually at the bottom of your screen) then choose "Software management" → "Install & remove software". In the upper left part of the window, there are 2 rolling lists: in both of them, choose "All". In the "Find" field, type "lamp", press the "Enter" key and choose in the list "task-lamp-php". You will probably be asked to install required packages: click on "OK". Then in the "Find" field, type "phpmyadmin", press "Enter", check phpmyadmin's box, click "OK" if asked for dependencies. Then click on "Apply" at the right bottom of the window and read carefully the upgrade information message for MariaDB. The installation of MariaDB also set a user and a user group both called "mysql" and who will own the files.

The same way, you can install just MariaDB and PhpMyAdmin, looking for "mariadb" in Mageia Software management, and choosing in the list the version of "mariadb" corresponding to your system: x86_64 for a 64 bits system, i586 for a 32 bits system.

Configure the database

All commands below need be entered as root.

  • Start MariaDB (i.e it was just installed) systemctl start mysqld It seems installing the rpm also sets MariaDB to start at boot (should it not, issue 'systemctl enable mysqld' )
  • Issue mysql_secure_installation to set/edit MariaDB administrative "root" password and perform a few security measures - just reply to the questions.
  • Then log in using that password: mysql -uroot -p, and there you can create a first database.

Usage

MariaDB uses SQL language. You can find the list of inline commands on MariaDB.com. There is a lesson about SQL on W3 schools, and one in French in Wikiversity, as well as lessons in French about the usage of MySQL (quite similar to MariaDB) on OpenClassrooms.

Troubleshooting

The log file, i.e. the file of errors, is /var/log/mysqld/mysqld.log .