Skip to content

Installation: sql db for Fedora

randikathryn edited this page Feb 23, 2014 · 36 revisions

Notes

The Fedora database stores information about the content in Fedora. A SQL database must be installed prior to installing Fedora.

Steps

These instructions reflect the use of the MySQL database.

  1. Install MySQL Server Version 5.6 by entering the commands below.
    Ubuntu: sudo apt-get install mysql-server
    CentOS:

    cd /opt/install  
    wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm  
    sudo rpm -ivh mysql-community-release-el6-5.noarch.rpm  
    sudo yum install mysql-server  
    cd /opt
  2. Type Y when asked "Is this ok [y/N]". Note: You will need to do this three times during the installation.

  3. Confirm that you installed MySQL-server version 5.6 - the version is listed in the download/install output which should look similar to the text below (with the ... indicating system generated code that has been intentionally left out of these instructions):

    ...
    sudo rpm -ivh mysql-community-release-el6-5.noarch.rpm
    mysql-community-common x86_64 5.6.15-1.el6 mysql56-community 296 k
    mysql-community-libs-compat x86_64 5.6.15-1.el6 mysql56-community 1.6 M

    Transaction Summary
    ================================================================================
    Install 7 Package(s)

    Total download size: 76 M
    Is this ok [y/N]: Y
    Is this ok [y/N]: Y
    Downloading Packages:
    Setting up and reading Presto delta metadata
    ...
    Userid : MySQL Release Engineering [email protected]
    Package: mysql-community-release-el6-5.noarch (installed)
    From : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    Is this ok [y/N]: Y
    Running rpm_check_debug
    Running Transaction Test
    ...
    Installed:
    mysql-community-client.x86_64 0:5.6.15-1.el6
    mysql-community-devel.x86_64 0:5.6.15-1.el6
    mysql-community-libs.x86_64 0:5.6.15-1.el6
    mysql-community-server.x86_64 0:5.6.15-1.el6

    Dependency Installed:
    libaio.x86_64 0:0.3.107-10.el6
    mysql-community-common.x86_64 0:5.6.15-1.el6
    mysql-community-libs-compat.x86_64 0:5.6.15-1.el6

    Replaced:
    mysql.x86_64 0:5.1.71-1.el6 mysql-devel.x86_64 0:5.1.71-1.el6
    mysql-libs.x86_64 0:5.1.71-1.el6

    Complete!

  4. Secure the MySQL-server and set the root password, using the commands below.
    Ubuntu: The installer will prompt you to set a root password.
    CentOS:

    1. Start MySQL by entering the command sudo service mysqld start in the terminal window.
    2. Enter the command /usr/bin/mysql_secure_installation.
    3. Follow the prompts to set the password and secure the database.
  5. (CentOS only) Set MySQL to run automatically on startup/reboot by entering the command sudo chkconfig mysqld on in the terminal window.

  6. Move MySQL and configure the data directory by entering the following commands in the terminal window.

    sudo service mysqld stop  
    sudo cp -a /var/lib/mysql/ /opt/  
    sudo mkdir /etc/mysql    
    sudo mv /etc/my.cnf /etc/mysql/  
  7. (Ubuntu only) If you are using apparmor, edit /etc/apparmor.d/local/usr.sbin.mysqld to add the lines that allow the /opt/mysql directory.

    /opt/mysql/ r,   
    /opt/mysql/** rwk,   
  8. Edit /etc/mysql/my.cnf, located in the [mysqld] section, as follows: 1. Change the data directory line to read:
    datadir=/opt/mysql 1. Set character set to utf8
    character_set_server=utf8

  9. Confirm permissions for MySQL directory and contents, by entering the command sudo chown -R mysql:mysql /opt/mysql.

  10. Restart MySQL by entering the command sudo service mysqld start.
    CentOS NOTE: if you have trouble restarting MySQL, please confirm that you have disabled SELinux

  11. Create the MySQL databases for Fedora.

    1. Log in to MySQL by entering the command mysql -u root -p.
    2. Enter the MySQL root password, which you set when you configured MySQL-server in Step 4 above.
    3. Create the database using the commands below.
      CREATE DATABASE fedora3;  
      GRANT ALL ON fedora3.* TO fedoraDBAdmin@localhost IDENTIFIED BY 'fedoraAdmin';  
      GRANT ALL ON fedora3.* TO fedoraDBAdmin@'%' IDENTIFIED BY 'fedoraAdmin';  
      exit   

    The final output should look like this:
    mysql> CREATE DATABASE fedora3;
    Query OK, 1 row affected (0.00 sec)
    mysql> GRANT ALL ON fedora3. TO fedoraDBAdmin@localhost IDENTIFIED BY 'fedoraAdmin';
    Query OK, 0 rows affected (0.00 sec)
    mysql> GRANT ALL ON fedora3. TO fedoraDBAdmin@'%' IDENTIFIED BY 'fedoraAdmin';
    Query OK, 0 rows affected (0.00 sec)
    mysql> exit
    Bye

Verification Steps

  1. Log in to MySQL by entering the command mysql -u root -p in the terminal window.

  2. Show the character sets by entering the command SHOW VARIABLES LIKE 'char%';.
    The output should look like this:

    +--------------------------+----------------------------+  
    | Variable_name            | Value                      |  
    +--------------------------+----------------------------+  
    | character_set_client     | utf8                       |  
    | character_set_connection | utf8                       |  
    | character_set_database   | utf8                       |  
    | character_set_filesystem | binary                     |  
    | character_set_results    | utf8                       |  
    | character_set_server     | utf8                       |  
    | character_set_system     | utf8                       |  
    | character_sets_dir       | /usr/share/mysql/charsets/ |  
    +--------------------------+----------------------------+  
    
  3. Check the storage engine by entering the command SHOW VARIABLES LIKE 'default%'; in the terminal window.
    The output should look like this.

    +----------------------------+--------+  
    | Variable_name              | Value  |  
    +----------------------------+--------+  
    | default_storage_engine     | InnoDB |  
    | default_tmp_storage_engine | InnoDB |  
    | default_week_format        | 0      |  
    +----------------------------+--------+  
    

Next Step

Proceed to Install Fedora or return to the Overview page.

Clone this wiki locally