How to Install and Configure Mysql Server on Oracle Linux
To Install and Configure Mysql Server on Oracle Linux
Introduction :
MySQL is a free and open-source relational database management system (RDBMS) that works on client/server and embedded systems. The MySQL Database Server is extremely fast, reliable, scalable, and easy to use.
Installation steps : Step 1 : check the version of the OS.
[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:4:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
Step 2 : Install the mysql packages.
[root@linuxhelp ~]# yum install mysql-server
Last metadata expiration check: 0:06:08 ago on Monday 20 December 2021 11:59:35 AM IST.
Dependencies resolved.
============================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================
Installing:
mysql-server x86_64 8.0.26-1.module+el8.4.0+20311+30d12931 ol8_appstream 25 M
Installing dependencies:
mariadb-connector-c-config noarch 3.1.11-2.el8_3 ol8_appstream 15 k
mecab x86_64 0.996-1.module+el8.0.0+5253+1dce7bb2.9 ol8_appstream 397 k
mysql x86_64 8.0.26-1.module+el8.4.0+20311+30d12931 ol8_appstream 12 M
mysql-common x86_64 8.0.26-1.module+el8.4.0+20311+30d12931 ol8_appstream 134 k
mysql-errmsg x86_64 8.0.26-1.module+el8.4.0+20311+30d12931 ol8_appstream 598 k
protobuf-lite x86_64 3.5.0-13.el8 ol8_appstream 149 k
Enabling module streams:
mysql 8.0
Transaction Summary
============================================================================================================================================
Install 7 Packages
Total download size: 38 M
Installed size: 195 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): mariadb-connector-c-config-3.1.11-2.el8_3.noarch.rpm 60 kB/s | 15 kB 00:00
(2/7): mysql-common-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64.rpm 718 kB/s | 134 kB 00:00
Total 6.7 MB/s | 38 MB 00:05
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 1/7
Installing : mysql-common-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64 2/7
Installing : mysql-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64 3/7
Installing : mysql-errmsg-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64 4/7
Installing : protobuf-lite-3.5.0-13.el8.x86_64 5/7
Installing : mecab-0.996-1.module+el8.0.0+5253+1dce7bb2.9.x86_64 6/7
Running scriptlet: mecab-0.996-1.module+el8.0.0+5253+1dce7bb2.9.x86_64 6/7
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-5.4.17-2102.201.3.el8uek.x86_64.conf:6: hwcap directive ignored
Running scriptlet: mysql-server-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64 7/7
Installing : mysql-server-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64 7/7
Running scriptlet: mysql-server-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64 7/7
ValueError: File context for /var/log/mysql(/.*)? already defined
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-5.4.17-2102.201.3.el8uek.x86_64.conf:6: hwcap directive ignored
Installed:
mariadb-connector-c-config-3.1.11-2.el8_3.noarch mecab-0.996-1.module+el8.0.0+5253+1dce7bb2.9.x86_64
mysql-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64 mysql-common-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64
mysql-errmsg-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64 mysql-server-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64
protobuf-lite-3.5.0-13.el8.x86_64
Complete!
Step 3 : start the mysql service
root@linuxhelp ~]# systemctl start mysqld.service
step 4 : Enable the mysql service
[root@linuxhelp ~]# systemctl enable mysqld
Step 5 : check the status of mysql
[root@linuxhelp ~]# systemctl status mysqld.service
● mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2021-12-20 12:24:56 IST; 15h ago
Main PID: 11593 (mysqld)
Status: "Server is operational"
Tasks: 39 (limit: 24798)
Memory: 464.4M
CGroup: /system.slice/mysqld.service
└─11593 /usr/libexec/mysqld --basedir=/usr
Dec 20 12:24:45 linuxhelp systemd[1]: Starting MySQL 8.0 database server...
Dec 20 12:24:45 linuxhelp mysql-prepare-db-dir[11513]: Initializing MySQL database
Dec 20 12:24:56 linuxhelp systemd[1]: Started MySQL 8.0 database server.
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
Step 6 : secure the mysql installation
[root@linuxhelp ~]# mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: n
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
New password:
Re-Enter new password:
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
Step 7 : Enter in to the mysql
[root@linuxhelp ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.26 Source distribution
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database school;
Query OK, 1 row affected (0.01 sec)
With this process of Installation and Configuration MySQL server on oracle Linux comes to an end
Q
What kind of Database is mysql?
A
Mysql is a relational database system.
Q
What is the current stable version of mysql?
A
The latest stable version of mysql is 8.0.27.
Q
How to backup the table in a database?
A
To backup the table in a database use mysqldump -u root -p database_name table_name > filename.sql
Q
Can we customize the data directory path in mysql?
A
yes we can change by editing the mysql configuration file.
Q
Is it possible to reset Root passsword in Mysql?
A
yes, it possible to reset Root passsword in Mysql.