For RHEL7/centos7 Follow here
Learn how to install mysql-5.7.20 on Rhel6/Centos6 with this easy step-by-step guide:
Step 1: Download the installation bundle First, download the mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar file by running the following command:
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar
Step 2: Extract the files Use the following command to extract the files from the bundle:
tar -xvf mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar
Step 3: Install mysql packages Now that you have the files, install the mysql packages by running the following command from the extracted directory:
yum -y install mysql-community-server-5.7.20-1.el6.x86_64.rpm mysql-community-common-5.7.20-1.el6.x86_64.rpm mysql-community-client-5.7.20-1.el6.x86_64.rpm mysql-community-libs-5.7.20-1.el6.x86_64.rpm mysql-community-libs-5.7.20-1.el6.x86_64.rpm
Step 4: Initialize and start mysql service
Before starting the mysql service, remove any content in the /var/lib/mysql/*
directory. Then, initialize the mysql service by running the following command:
mysqld --initialize --user=mysql
Start the mysql service by running the following command:
service mysqld start
Step 5: Retrieve the temporary root password Use the following command to retrieve the temporary root password from the mysql log:
cat /var/log/mysqld.log |grep -i 'temporary password'
Step 6: Change the root password Log in as root using the temporary password you retrieved in the previous step:
mysql -u root -p
Then, change the root password using the following command:
mysql> alter user 'root'@'localhost' identified by 'new_password';
Step 7: Quit
Finally, exit the mysql prompt by typing quit
.
No comments:
Post a Comment