How to install MySQL on CentOS 8

MySQL is the most popular open source relational database management system in the world.

In the default CentOS 8 system source repository, the latest available version of the MySQL database server is 8.0.

MySQL 8.0 introduces many new features and modifications, so some applications may not be compatible with this version. When choosing which version of MySQL to install, please carefully read the relevant documents of the application (on the CentOS server where you want to deploy the database).

CentOS 8 also provides MariaDB 10.3, which can perfectly replace MySQL 5.7, but there are some limitations. If your application is not compatible with MySQL 8.0, you can install MariaDB 10.3.

In this article, we will show you how to safely install MySQL 8.0 on CentOS 8 system.

1. Install MySQL 8.0 on CentOS 8

As root or another user with sudo privileges, install the MySQL 8.0 server by using the CentOS package manager:

sudo dnf install @mysql

@ The mysql module will install MySQL and all dependent installation packages.

Once the installation is complete, start the MySQL service and enable the boot function, run the following command:

sudo systemctl enable --now mysqld

To check whether the MySQL server is running, enter:

sudo systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
 Loaded:loaded(/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
 Active:active(running) since Thu 2019-10-1722:09:39 UTC; 15s ago
   ...

Second, protect MySQL

Run the mysql_secure_installation script, perform some security-related operations, and set the MySQL root user password:

sudo mysql_secure_installation

You will be asked to configure VALIDATE PASSWORD PLUGIN, this plugin is used to test the password strength of MySQL users and improve security. There are three password security levels, weak, medium, and strong. If you don't want to set up a password verification plug-in, please press Enter directly.

At the next prompt, you will be asked to set a password for the MySQL root user. Once you are done, the script will ask you to remove anonymous users, restrict root user access to the local machine, and remove the test database. You should return to "Y" (yes) for all questions.

In order to interact with the MySQL database through the terminal command line, use the installed MySQL client tool. To test root user access, enter:

mysql -u root -p

When prompted, enter the root user password, and the MySQL shell will display the following:

Welcome to the MySQL monitor.  Commands end with; or \g.
Your MySQL connection id is 12
Server version:8.0.17 Source distribution

That's it, you have installed and protected MySQL 8.0 on your CentOS 8 server, and you can use it.

Three, user verification##

MySQL 8.0 in the CentOS 8 source repository is set to use the ancient mysql_native_password user authentication plugin, because some client tools and libraries on CentOS 8 are not compatible with caching_sha2_password, the standard MySQL 8.0 default method.

mysql_native_password is fine in most settings. If you want to change the default user authentication plugin to a faster and safer caching_sha2_password, open the following configuration file:

sudo vim /etc/my.cnf.d/mysql-default-authentication-plugin.cnf

Modify the default default_authentication_plugin to caching_sha2_password:

[ mysqld]
default_authentication_plugin=caching_sha2_password

Close and save the file, and restart the MySQL server to make the changes take effect:

sudo systemctl restart mysqld

Four, summary##

MySQL 8.0 is available on CentOS 8. This installation can be done by simply typing dnf install @mysql.

Now that your MySQL server is up and running, you can connect to the MySQL shell and start creating new databases and users.

Recommended Posts

How to install MySQL on CentOS 8
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
How to install jdk1.8 on centOS7
How to install MySQL on Ubuntu 20.04
How to install Memcached on CentOS 8
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install TensorFlow on CentOS 8
How to install MySQL on Ubuntu 20.04
How to install TeamViewer on CentOS 8
How to install Perl 5 on CentOS
How to install Git on CentOS 8
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Java on CentOS 8
How to install Go on CentOS 8
How to install GCC on CentOS 8
How to install Yarn on CentOS 8
How to install Nginx on CentOS 8
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install Vagrant on CentOS 8
How to install Python 3.8 on CentOS 8
How to install Tomcat 9 on CentOS 8
How to install Webmin on CentOS 8
How to install Ruby on CentOS 8
How to install Skype on CentOS 8
How to install htop on CentOS 8
How to install Python on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Postgresql on CentOS 8
How to install Wordpress on Centos
How to install htop on CentOS 8
How to install TeamViewer on CentOS 8
How to install MariaDB on CentOS 8
How to install MongoDB on CentOS 7
How to install Odoo 13 on CentOS 8
How to install Apache on CentOS 8
How to install OpenCV on CentOS 8
How to install MySQL on Ubuntu 14.04
How to install PHP on CentOS 8
How to install MongoDB on CentOS 8
How to install Apache Maven on CentOS 8
How to install Apache Kafka on CentOS 7
How to install MySQL on Ubuntu 18.04 (linux)
[Graphic] How to install tomcat on centos
R&D: How To Install Python 3 on CentOS 7
How to install GCC compiler on CentOS 7
How to install offline JDK1.8 on centos7.0
Install mysql online on centos
Install MySQL 8.0.16 on Linux Centos
How to install and configure Elasticsearch on CentOS 7
How to install Visual Studio Code on CentOS 8
How to install and use Docker on CentOS 7
How to install RPM packages on CentOS Linux
How to install and configure VNC on CentOS 8
How to install and use Composer on CentOS 8
How to install and configure Redis on CentOS 8
How to install Node.js and npm on CentOS 8