Saturday, January 16, 2021

MySQL 8 installation using binary distribution on Oracle Enterprise Linux 7 (OEL 7)

Most Oracle Enterprise Linux (OEL) operating systems may already be having an existing MySQL installation. It is important that any existing MySQL server process be terminated before attempting to start the MySQL server process from a new installation.

Also, one should update the PATH environment variable to refer to the new installation's bin folder before performing the new MySQL server administration.

1) Login as root

2) ps -ef | grep mysqld

If you find an existing mysqld process already running (For example /usr/libexec/mysqld) , then terminate it using the kill command.

3) Download mysql-8.0.22-el7-x86_64.tar.gz binary distribution from https://dev.mysql.com/downloads/mysql/5.5.html?os=31

4) Copy mysql-8.0.22-el7-x86_64.tar.gz to /usr/local

5) Create a mysql operating system user and assign it an operating system group called mysql (If not already present). The /bin/false option will prevent mysql operating system user from interactive login to the Linux operating system.

groupadd mysql useradd -r -g mysql -s /bin/false mysql

6) cd /usr/local

7) gunzip mysql-8.0.22-el7-x86_64.tar.gz

8) tar -xvf mysql-8.0.22-el7-x86_64.tar

9) ln -s mysql-8.0.22-el7-x86_64.tar mysql

10) cd mysql

11) mkdir mysql-files

12) chown mysql:mysql mysql-files

13) chmod 750 mysql-files

14) bin/mysqld --initialize --user=mysql

The initialize command initializes the data directory. MySQL uses /var/lib/mysql directory as default data directory for Linux based systems.

Note the password from the message "A temporary password is generated for root@localhost:"

15) bin/mysql_ssl_rsa_setup

16) bin/mysqld_safe --user=mysql &

Change the default password of the root superuser account.

17) export PATH=/usr/local/mysql/bin:$PATH (Make this PATH environment variable setting permanent so that subsequent logins as root operating system user automatically sets it this way).


18) which mysql (Must show it as /usr/local/mysql/bin/mysql


19) mysql -u root -p -h localhost




20) alter user 'root'@'localhost' identified by 'mysql';



No comments:

Related Posts Plugin for WordPress, Blogger...