In this tutorial, you will learn how to install MySQL 8 on Oracle Linux 7. This article gives example of installing on MySQL on Oracle Linux. Linux supports a number of different solutions for installing MySQL.
Server / Environment Details:
Operating System Name / Version |
Oracle Linux 7.4 (64 bit) |
MySQL Database Version |
8.0 |
Hostname |
demodbhost |
IP Address |
192.168.0.100 |
Linux
Installation Methods and Information:
Type |
Setup Method |
Apt |
Enable the MySQL Apt repository |
Yum |
Enable the MySQL Yum repository |
Zypper |
Enable the MySQL SLES repository |
RPM |
Download
a specific package |
DEB |
Download
a specific package |
Generic |
Download
a generic package |
Source |
Compile from source |
Docker |
Use Docker Hub for MySQL Community Edition; download Docker image for
MySQL Enterprise Edition from My Oracle Support |
Oracle
Unbreakable Linux Network |
Use ULN channels |
As an alternative, you can use the package manager on your system
to automatically download and install MySQL with packages from the native
software repositories of your Linux distribution. These native packages are
often several versions behind the currently available release.
Install
MySQL on Linux Using MySQL Yum Repository:
Adding MySQL Yum Repository:
Download
MySQL Yum Repository from https://dev.mysql.com/downloads/repo/yum/ for your Operating
System and Install the downloaded release package with the following command:
[root@demodbhost sw_dump]# yum localinstall
mysql80-community-release-el7-3.noarch.rpm
Use this command to see all the sub-repositories
in the MySQL Yum repository, and see which are enabled:
[root@demodbhost sw_dump]# yum repolist enabled | grep
"mysql.*-community.*"
Install MySQL 8 Community Server:
When using the MySQL Yum repository, the
latest GA series is selected for installation by default.
Use this command to see all the sub-repositories
in the MySQL Yum repository, and see which of them are enabled or disabled.
[root@demodbhost sw_dump]# yum repolist all | grep mysql
The repository which is enabled will be
installed in the system. If you want to install a particular version then, disable
other versions and enable that particular version.
For example, if want to install MySQL 5.7 then
disable all other versions and keep MySQL 5.7 repository enabled:
[root@demodbhost sw_dump]# sudo
yum-config-manager --disable mysql80-community
[root@demodbhost sw_dump]# sudo yum-config-manager --enable mysql57-community
Execute the following command to install MySQL
8 (as its enabled in our environment here):
[root@demodbhost sw_dump]# yum install mysql-community-server
Start and enable MySQL Service:
Use this command to start mysql service:
[root@demodbhost sw_dump]# service mysqld start
You can check the status of the MySQL server
with the following command:
[root@demodbhost sw_dump]# service mysqld status
Make sure the mysqld service is set to start
on reboot and start the service. Execute following command:
[root@demodbhost sw_dump]# chkconfig mysqld on
At the initial startup of the server, the
following happens, given that the data directory of the server is empty:
·
SSL certificate and key
files are generated in the data directory.
·
validate_password is
installed and enabled.
· A superuser account 'root'@'localhost is created. A password for the superuser is set and stored in the error log file.
Get default password for root user and change it accordingly:
When you install MySQL, the root user account
is granted a temporary password. To show the password of the root user account,
use this command:
[root@demodbhost sw_dump]# grep 'temporary password' /var/log/mysqld.log
Note that your temporary password will be
different for all installations. You will need this password for changing the
password of the root user account.
Connect to mysql and change the root password:
[root@demodbhost sw_dump]# mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Demo#1NewPass';
Use the SHOW DATABASES command to display all
databases in the current server:
mysql> show databases;
No comments:
Post a Comment