+5 votes
1.7k views
How to install or uninstall MySQL in CentOS 8

in Databases by (552k points)
reopened | 1.7k views

1 Answer

+3 votes
Best answer

1. How to install MySQL on CentOS 8
2. How to enable MySQL in CentOS 8
3. How to secure MySQL in CentOS 8
4. How to log in to MySQL
5. How to uninstall MySQL in CentOS 8

Database management is one of the most delicate tasks in an organization since in those bases there may be delicate and vital elements for the proper functioning of the organization and system components. Hence the importance of working with comprehensive database managers, rich in functions and where their performance is as complete and available as an unstable database will certainly bring more than one problem..

MySQL is one of the best known and most secure solutions for managing databases in various operating systems and is reliable since it has been developed as an SQL database management engine. Being open source its functions can be more and more extensive every day since MySQL is distributed and supported by Oracle Corporation which gives us a part of security in its daily use.

MySQL Features
Among the main features of MySQL we highlight the following:
  • It is written in C and C ++
  • For compatibility issues, MySQL uses CMake in MySQL 5.5 and higher, while in previous versions GNU Automake, Autoconf and Libtool are used.
  • Supports the use of multiple compilers.
  • Integrates the use of B-tree (MyISAM) disk tables with index compression.
  • It has a multi-layer server design with independent modules.
  • Integrates transactional and non-transactional storage engines.
  • Implements SQL functions using an optimized class library focused on improving database performance.
  • It executes a memory allocation system which is based on threads to optimize the actions.
  • It implements hash tables in memory which act as temporary tables.
  • Execute multithreaded tasks using kernel threads.
  • Compatible with various types of data both 1, 2, 3, 4 and 8 bytes long, FLOAT, DOUBLE, CHAR, VARCHAR, BINARY, VARBINARY, TEXT, BLOB, DATE, TIME, DATETIME, TIMESTAMP, YEAR, SET, ENUM and OpenGIS.
  • Supports chain types of fixed length and variable length.
  • It has support for LEFT OUTER JOIN and RIGHT OUTER JOIN with standard SQL and ODBC syntax.
  • Execute the EXPLAIN instruction to explain how the optimizer solves a query.
  • MySQL is able to refer to tables available in different databases using the same statement.
  • Supports DELETE, INSERT, REPLACE and UPDATE functions.
  • At the security level MySQL offers a secure privilege and password system which allows host-based verification.
  • Password security is done through the encryption of all password traffic when establishing a connection with a server.
  • It has support for large databases.
  • It offers support for up to 64 indexes per table.
  • Each MySQL client can connect through TCP / IP sockets using any of the supported platforms.
  • All C, C ++, Eiffel, Java, Perl, PHP, Python, Ruby and Tcl APIs are available, this allows MySQL clients to write in many available programming languages.
  • The Connector / ODBC (MyODBC) interface includes MySQL support for various client applications that connect through ODBC (Open Database Connectivity) connections.
  • The server can generate error messages to clients in various languages.
  • Full support for multiple types of characters.
  • The server time zone can be changed dynamically.
  • MySQL integrates various clients and utilities to increase management capabilities.
  • MySQL Server offers built-in support to execute SQL statements that allow you to verify, optimize and repair tables.

MySQL can be installed on CentOS 8 in the x86_64, ARM 64 and download CentOS8 architectures. If you don't have it yet, you find it available at the following link:

CentOS 8

Now we will see how to install this great utility in CentOS 8 and thus have one more alternative to manage and administer the databases..


1. How to install MySQL on CentOS 8

Step 1

The first step to take will be to enable the official repositories of MySQL 8.0 (current version) in CentOS 8 and for this we must execute the following command:
 yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm 
Note
This repository includes the following:
  • MySQL 8.0
  • MySQL 5.7
  • MySQL 5.6
  • MySQL Cluster 8.0 (RC)
  • MySQL Cluster 7.6
  • MySQL Cluster 7.5
  • MySQL Workbench
  • MySQL Router
  • MySQL Shell
  • MySQL Connector / C ++
  • MySQL Connector / J
  • MySQL Connector / ODBC
  • MySQL Connector / Python
image
Step 2

Enter the letter S to confirm the download and installation of the repository: image
Step 3

Next, we will install the MySQL server by running the following command:
 yum install mysql-server 
image
Step 4

Enter the letter S again to proceed with the download and installation of the respective packages: image
Step 5

During the process we must accept the import of the GPG key: image
Step 6

When this ends we will see the following: image
Step 7

As an extra point we want to verify that we are in CentOS 8, for this we execute:
 cat / etc / redhat / release 
image

Up to this point we have installed the MySQL server in CentOS 8 correctly.


2. How to enable MySQL in CentOS 8

Step 1

The next step will be to start the MySQL service and enable it at startup, for this we execute the following:
 systemctl enable mysqld systemctl start mysqld 
image
Step 2

We can check the status of MySQL by running:
 systemctl status mysqld 
image
Step 3

In case we want to disable the MySQL service, we will execute:
 systemctl disable mysqld 
Step 4

If the purpose is to stop the service we must execute the following:
 systemctl stop mysqld 

3. How to secure MySQL in CentOS 8

Step 1

When the MySQL server is run for the first time, a temporary password is generated for the MySQL root user, it can be validated by executing the following command:
 grep 'temporary password' /var/log/mysqld.log 
Step 2

We must write down this password since with the following order the system will request that the temporary root password be entered, but with the new version of MySQL. Such temporary password execution is not always required since we can directly secure the server by executing the following:
 mysql_secure_installation 
This command will display the following wizard where we first enter the letter "y" to assign the password component and then offer 3 levels of security that are:
  • LOW (low): up to 8 characters.
  • MEDIUM (Medium): This level allows a minimum of 8 characters including numbers, letters and special characters.
  • STRONG (Strong): It is the safest level since it allows numbers, letters, special characters and dictionary.
image
Step 3

We must enter the desired number based on level 0 (LOW), 1 (MEDIUM) or 2 (STRONG) and then enter the desired password.

Then we enter the letter "y" to accept the password and then a series of administration questions will be launched such as:

  • Remove anonymous users
  • Disallow remote root login
  • Remove test database
  • Reload privilege tables (Reload privileges)
Step 4

The idea is to accept each of these orders and finally we will see the following: image

4. How to log in to MySQL

Step 1

Once processed we will access the MySQL server by running:
 mysql –u root –p 
Enter the password set above and we will see the following: image
Step 2

Now it will be possible to create our database in MySQL:
 CREATE DATABASE TechnoWikis; use TechnoWikis; CREATE TABLE users ( id INT PRIMARY KEY, name VARCHAR (30), email VARCHAR (30) ); 
image

To exit the database we execute the exit command..

Step 3

At the moment we want to update MySQL we must execute the following:
 yum update mysql-server 
Up to this point we have seen all the features of MySQL and their respective installation in CentOS 8.

5. How to uninstall MySQL in CentOS 8

Step 1

At the moment when it is no longer necessary to use more MySQL in CentOS 8, we can remove it from the system by executing the following:
 yum remove mysql mysql-server 
image
Step 2

Enter the letter S to confirm the uninstallation: image
Step 3

By default, the path of the MySQL data directory is / var / lib / mysql., An option suggested by TechnoWikis is to change the name of this directory instead of deleting it since this will keep a backup copy of the MySQL configuration, for this we execute the following:
 mv / var / lib / mysql / var / lib / MySQL_back 
image

We can install MySQL again if we wish.

TechnoWikis has explained the complete process to install or remove MySQL in CentOS 8 and thus have this excellent database management tool.


by (3.5m points)
edited

Related questions

+3 votes
1 answer
asked Nov 13, 2020 in Databases by backtothefuture (552k points) | 443 views
+4 votes
1 answer
asked Aug 21, 2019 in Databases by backtothefuture (552k points) | 363 views
+5 votes
1 answer
+4 votes
1 answer
asked Jun 23, 2019 in Databases by backtothefuture (552k points) | 228 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users