On Linux:

The below high-level steps were used to install and configure MySQL on a CentOS 7.9 Linux server.

  1. Login to the server with root credentials.

  2. (Optional) Update the server prior to the install.

›_ Console

# yum update 
  1. Go to the directory where MySQL Zip file is copied and unzip it.

  2. Install MySQL using the following command:

›_ Console

# yum localinstall ./*.rpm 

During the installation, you might be prompted to enter the password for the root user for your MySQL installation.

  1. When installing MySQL on CentOS 7.9, a temporary root password is generated and available in mysqld.log file under /var/log.

  2. Log in to the MySQL client.

›_ Console

# mysql -h 127.0.0.1 -uroot -p 
  1. Enter the Temporary password created for the root user.

  2. Change the root password.

›_ Console

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '<NEW_PASSWORD>'; mysql> FLUSH PRIVILEGES;
mysql> exit; 

9. Test the new password.

›_ Console

# mysql -u root -p<new_password>