Installing / Upgrading MySql 8 in Red Hat Linux / CentOS



Step by step commands for installing or upgrading existing mysql 5.7 into 8.0. 
Here used CentOS and community server https://dev.mysql.com/downloads/mysql/

Download mysql mysql-8.0.12-1.el7.x86_64.rpm-bundle.tar


Step 1
          Sometimes there may some dependency error occurred when removing existing(here mysql 5.7) database.
                  
                         yum remove postfix mariadb-libs

Step 2
         For removing all existing mysql installation

                         rpm -qa | grep -i mysql | xargs rpm -e

Step 3
       Command for installing new version(here only added needed installation files)

                        yum localinstall mysql-community-client-8.0.12-1.el7.x86_64.rpm mysql-community-libs-8.0.12-1.el7.x86_64.rpm mysql-community-libs-compat-8.0.12-1.el7.x86_64.rpm mysql-community-server-8.0.12-1.el7.x86_64.rpm mysql-community-common-8.0.12-1.el7.x86_64.rpm

Step 4
        For upgrading(means data directory not deleted and use in mysql 8)

                         mysql_upgrade -u root -p (here password is the old password used in old                 version)

Initializing the Data Directory Manually Using mysqld


In Fresh installation, normally mysql will create new data directory and set new root password with expiry date. If not, can do the same by below step

     Create a data directory(empty folder)
Move cursor location into newly created folder
Apply command mysqld –initialize (https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization-mysqld.html)
Specify this folder/directory location in my.ini / my.cnf file as data directory

Same step you can use for creating a fresh data directory.







Comments