MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

MySQL on Fedora 30

with one comment

While updating my class image to Fedora 30, I noticed that it installed the Akonadi Server. The documentation on the Akonadi server lacked some straightforward documentation. It also offered a bundled set of software that limited how to approach MySQL development.

So, I removed all those packages with the following syntax:

dnf remove `rpm -qa | grep akonadi`

After removing those Akonadi packages, I installed the MySQL Community Edition from the Fedora repo with this syntax:

yum install -y community-mysql*

Having installed MySQL Community Edition, I wanted to start the mysql service with this command:

sudo service mysqld start

Unfortunately, the service utility wasn’t installed. That surprised me. While I could have run this command:

systemctl start mysqld.service

A better solution was to install any missing code components. I determined that the service utility is part of the initscripts package; and I installed it with the following command:

sudo yum install -y initscripts

Then, I ran the mysql_secure_installation script to secure the installation:

mysql_secure_installation

The script set the root user’s password, remove the anonymous user, disallow remote root login, and remove the test databases. Then, I verified connecting to the MySQL database with the following syntax:

mysql -uroot -ppassword

I enabled the MySQL Service to start with each reboot of the Fedora instance. I used the following command:

systemctl enable mysqld.service

It creates the following link:

ln -s '/etc/systemd/system/multi-user.target.wants/mysqld.service' '/usr/lib/systemd/system/mysqld.service'

The next step requires setting up a sample studentdb database. The syntax has changed from prior releases. Here are the three steps:

  1. Create the studentdb database with the following command as the MySQL root user:

    mysql> CREATE DATABASE studentdb;
  2. Grant the root user the privilege to grant to others, which root does not have by default. You use the following syntax as the MySQL root user:

    mysql> GRANT ALL ON *.* TO 'root'@'localhost';
  3. Create the user with a clear English password and grant the user student full privileges on the studentdb database:

    mysql> CREATE USER 'student'@'localhost' IDENTIFIED WITH mysql_native_password BY 'student';
    mysql> GRANT ALL ON studentdb.* TO 'student'@'localhost';

If you fail to specify mysql_native_password when creating the user and use the older syntax like the following example:

mysql> CREATE USER 'student'@'localhost' IDENTIFIED BY 'student';
mysql> GRANT ALL ON studentdb.* TO 'student'@'localhost';

The GRANT command will raise the following error:

ERROR 1410 (42000): You are not allowed to create a user with GRANT

Written by maclochlainn

August 16th, 2019 at 1:02 am

Posted in MySQL,MySQL 8

Tagged with ,