In SIdora, MySQL is used to support Fedora. While there is no functional reason why the Fedora and Drupal databases cannot be co-located, it is recommended that in production separate databases be used since normally these products are running in separate execution environments, and the tuning is very different. This is a decision, however, that needs to be made based on local circumstances and is outside the scope of this article. There are too many options and alternatives for configuring a database so the following instructions should be considered a starting point that can be tailored for your specific needs.

Step-by-step guide

Add the steps involved:

  1. Install MySQL.  SIdora is tested with MySQL 5.6.31.  Versions later than 5.1 should work but for production the latest Version 5.x is recommended.  Other databases can be used notably PostgreSQL.  MySQL is no longer being distributed with RHEL 7 so you will have to install from downloaded packages:

    rpm -ivh MySQL-server-5.6.31-1.el6.x86_64.rpm
    rpm -ivh MySQL-client-5.6.31-1.el6.x86_64.rpm


  2. Start MySQL:

    chkconfig mysql on # Automatically start mysqld on boot
    service mysql start # Start mysqld for configuration


  3. PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root user! You likely will need to get the random password in /root/.mysql_secret first.  Start the server, then issue the following commands:

    /usr/bin/mysqladmin -u root password '<root-secret>'
    /usr/bin/mysqladmin -u root -p -h localhost.localdomain password '<root-secret>'


  4. Alternatively you can run /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is recommended for production servers. See the MySql manual for more instructions.
  5. Create Database, Users and Privileges. We will create the databases needed for Fedora in the following operations. We will also create the users and permissions needed for Fedora.

    [user@server] mysql -u root -p
    mysql> CREATE DATABASE fedora3;
    mysql> GRANT ALL ON fedora3.* TO '<fedoradbuser>'@localhost IDENTIFIED BY '<secret>';
    mysql> FLUSH PRIVILEGES;
    mysql> EXIT;


  6. If any services access the database remotely, permission for the client must be added to the database.  Likely you should be more restrictive in production granting access to only a limited set of IP addresses:

    [user@server] mysql -u root -p
    mysql> GRANT ALL PRIVILEGES ON fedora3.* TO '<fedoradbuser>'@'%' IDENTIFIED BY '<secret>';
    mysql> FLUSH PRIVILEGES;
    mysql> EXIT;


Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.