MySQL 8.0 on CentOS 7
Discover the process of installing MySQL 8.0 on CentOS 7.
This article demonstrates MySQL installation on Cent OS Linux 7 version.
Installation of MySQL
Install wget to download MySQL repository
yum install wget
![](https://static.wixstatic.com/media/cb6190_731f7641db36476781b30fba22383f78~mv2.png/v1/fill/w_49,h_49,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_731f7641db36476781b30fba22383f78~mv2.png)
Download MySQL
# wget https://repo.mysql.com//mysql80-community-release-el7-5.noarch.rpm
![](https://static.wixstatic.com/media/cb6190_1d31667a43c34b73a599fa830328dd42~mv2.png/v1/fill/w_49,h_19,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_1d31667a43c34b73a599fa830328dd42~mv2.png)
Adding the MySQL Yum Repository
# yum install mysql80-community-release-el7-5.noarch.rpm
![](https://static.wixstatic.com/media/cb6190_4a1f7e2595f74db2840cd52e28c75e76~mv2.png/v1/fill/w_49,h_42,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_4a1f7e2595f74db2840cd52e28c75e76~mv2.png)
Installing MySQL
$ yum install mysql-community-server
![](https://static.wixstatic.com/media/cb6190_b2d8e54d9ede4a729db45d4e12575a2c~mv2.png/v1/fill/w_49,h_42,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_b2d8e54d9ede4a729db45d4e12575a2c~mv2.png)
![](https://static.wixstatic.com/media/cb6190_655257ac2be7423caf9ccc680b803c1c~mv2.png/v1/fill/w_49,h_42,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_655257ac2be7423caf9ccc680b803c1c~mv2.png)
Start MySQL service and enable it to auto-start on reboot
# chkconfig mysqld on
# service mysqld start
![](https://static.wixstatic.com/media/cb6190_b86cf7b1a7a5410f97a91ac31e96f84f~mv2.png/v1/fill/w_49,h_12,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_b86cf7b1a7a5410f97a91ac31e96f84f~mv2.png)
Start the MySQL server with the following command
# systemctl start mysqld
You can check the status of the MySQL server with the following command:
# systemctl status mysqld
![](https://static.wixstatic.com/media/cb6190_b78186aba2a2461486003fdde013ffd4~mv2.png/v1/fill/w_49,h_23,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_b78186aba2a2461486003fdde013ffd4~mv2.png)
A superuser account 'root'@'localhost' is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command
# grep 'temporary password' /var/log/mysqld.log
![](https://static.wixstatic.com/media/cb6190_b15739d39d9f446995c9e02ece7feee4~mv2.png/v1/fill/w_49,h_8,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_b15739d39d9f446995c9e02ece7feee4~mv2.png)
Change the root password as soon as possible by logging in with the generated, temporary password and set a custom password for the superuser account:
# mysql -uroot -p
![](https://static.wixstatic.com/media/cb6190_448f075b2aeb465f96cb8acf33c562f5~mv2.png/v1/fill/w_49,h_17,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_448f075b2aeb465f96cb8acf33c562f5~mv2.png)
mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
![](https://static.wixstatic.com/media/cb6190_b480cbb2a98b41ca83f0373f24633593~mv2.png/v1/fill/w_49,h_9,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_b480cbb2a98b41ca83f0373f24633593~mv2.png)
![](https://static.wixstatic.com/media/cb6190_a8dd35786a77436f8137b41959c01b3d~mv2.png/v1/fill/w_49,h_19,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_a8dd35786a77436f8137b41959c01b3d~mv2.png)
Create MySQL Database
Use the below command to create a new database
mysql> create database mydb;
List all the databases
mysql> show databases;
To switch between databases use the below command
mysql> exit
![](https://static.wixstatic.com/media/cb6190_bcaeb4a6895f4e3491ec37952864f0e1~mv2.png/v1/fill/w_49,h_26,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_bcaeb4a6895f4e3491ec37952864f0e1~mv2.png)
You can make new connections directly to the database as follows.
$ mysql --user=root --database=mydb --password
Enter password:
![](https://static.wixstatic.com/media/cb6190_1fe7fc16dd484cc6a866c5cdc8cab8ed~mv2.png/v1/fill/w_49,h_19,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_1fe7fc16dd484cc6a866c5cdc8cab8ed~mv2.png)
Installation Done!