How to install MySQL (or MariaDB) on Fedora

For your webdevelopment you probably need to communicate with database server. On Fedora you can run standard databases like MySQL, SQLite, Postgresql and many others. Very popular in combination with Apache and PHP is MySQL database.

It is very easy install and run MySQL on Fedora. Or wait... better. Why to install MySQL if you can install MariaDB? MariaDB is GNU GPL fork of the MySQL and offers more storage engines than MySQL. For more details about that you can try Google.

To install MariaDB just type in your termina:
$ sudo dnf install mariadb-server


After installation you can configure MariaDB to automatic start. Start it now and check the status of MariaDB:
$ sudo systemctl enable mariadb.service

$ sudo systemctl start mariadb

$ sudo systemctl status mariadb


MariaDB - status check

After that it is good to setup some security. You can do it with command:
$ sudo mysql_secure_installation


Note that default root password is empty. Just hit Enter key. Then you can setup new root password, disable remote login for user, disable default user, etc. Just answer Yes or No to some questions.

If you can some tool for managing your MariaDB, you can use webtool PhpMyAdmin. Install it with this command:
$ sudo dnf install phpmyadmin


That should install php-mysqlnd (a module for PHP applications that use MySQL databases) too. If you don't install PhpMyAdmin or if you have any problems with php - Mysql / MariaDB communication, you can install it separately with this command:
$ sudo dnf install php-mysqlnd


Then you can try access url: http://localhost/phpmyadmin/ and you should see login page of PhpMyAdmin:

PhpMyAdmin login page

Of course if you would rather MySQL than MariaDB, use the equivalent commands with mysql instead of mariadb.
$ sudo dnf install mysql-server

$ sudo systemctl enable mysqld

$ sudo systemctl start mysqld

PhpMyAdmin homepage with information about your Database and Web server