Install MySQL 8 & phpMyAdmin on CentOS 8

This post would provide a tutorial to install MySQL 8 and phpMyAdmin 5 on CentOS 8. Please note that you have to install the PHP and Apache before starting the installation for phpMyAdmin, you could also refer to this post I wrote before to finish the installation for PHP and Apache.

MySQL
Step 1
Ads

Install MySQL 8.

We could install MySQL directly using the version on AppStream of CentOS8.

 

Step 2

Start MySQL and set it start automatically.

 

Step 3

Find out the default passwords of MySQL.

We had already started MySQL in Step 2, so MySQL should produce a temporary passwords. Therefore, you could find out the randomly temporary passwords in the log file of MySQL.

 

Step 4

Change passwords of root.

If you want to change passwords and the security level as well, you could choose this program to help you.

 

Once if you just want to change root’s passwords, you could use these command under below.

In the CLI mode of MySQL, you could use command exit; to terminate.

 

Finally, you could re-login MySQL to check root’s new passwords was changed correctly.

 

phpMyAdmin
Step 1

Download and install phpMyAdmin.

You’d better download 4.9 or higher version of phpMyAdmin that can support MySQL 8. Then decompress zip file and put the folder you unpacked to the path you want. In this post, I assumed that the root path of website is located at “/var/www”.

If you’re not sure which version of phpMyAdmin, then you could refer to this page created by phpMyAdmin official, and there is some recommendation for you.

Before you start Step 1, there is another thing you have to do is to install weget and zip. And the unzip will be added into related packages when zip is installed.

 

Step 2

Edit config of Apache.

Let’s edit the configuration file.

 

However, there are two different use cases that will affect the way for your modification.

  1. Your phpMyAdmin is attached to an exists website which is an independent domain.
    All you need to do is copy the settings under below and paste them into the block of your website, and that means before the tag </VirtualHost> of your website’s settings. Through these settings, you could visit phpMyAdmin by the URL like this “http://YourDomain/AliasNameForPHPMyadmin”.
  2. Your phpMyAdmin is an independent website and owns its domain name.
    This way would need you to copy the whole block of settings to your configuration file. Of course, you could visit phpMyAdmin through the domain name that you setup.

 

Step 3

Permission setting.

You have to permit these folders to be able to access by Apache.

 

Step 4

Finally, it’s not doubtable that you have to restart Apache to make these adjustments be activated. 

 

Andy Wang

Non-stop learning and facing challenges.

One thought on “Install MySQL 8 & phpMyAdmin on CentOS 8

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.