How to install MySQL using yum on Centos7 and achieve remote connection

How to install MySQL using yum on Centos7 and achieve remote connection

Centos7 uses yum to install MySQL and how to achieve remote connection. Because MySQL was acquired by Oracle, it is currently recommended to use mariadb database

Here are the steps:

1)yum install mariadb

2) yum install mariadb-server

3) yum install mariadb-devel

chmod -R 770 /var/lib/mysql
systemctl restart mariadb.service

Now the MySQL installation is complete

Initialize password:

Execute the mysql command to set the initial password

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('input the password you like');

Tips:

Remotely connect to the database:

1)mysql -u root -p password ;use mysql ;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; Allow any IP to log in as root user to flush privileges; effective immediately

2) Modify the my.cnf file and comment out the bindaddress statement, if any

3) Check the firewall

systemctl status iptables.service /firewalld.service and shut down

In addition, if you do not want to close the firewall, you can add rules. The following is to add using the command

1) Make sure the firewall is enabled

2) Execute the command firewall-cmd --permanent(永久) --add-port=3306 (default port)/tcp (protocol) and respond with success

3) Run the command to check whether the rule is added successfully firewall-cmd --permanent --query-port=3306/tcp

4) Restart the firewall to take effect systemctl restart mariadb.service

The above is the method that I introduced to you to install MySQL and realize remote connection using yum on Centos7. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Detailed tutorial on installing MySQL 8.0 from source code on CentOS 7.4
  • Installation tutorial of mysql8.0rpm on centos7
  • Detailed steps to install Mysql5.7.19 using yum on Centos7
  • Detailed tutorial on installing Mysql5.7.19 on Centos7 under Linux
  • How to quickly install MySQL 5.7 using YUM under Centos 7.2
  • Detailed tutorial on installing MySQL 8 in CentOS 7

<<:  Linux centOS installation JDK and Tomcat tutorial

>>:  Example of using setInterval function in React

Recommend

Automatic line breaks in html pre tags

At this time, you can use overflow:auto; (when the...

Vue must learn knowledge points: the use of forEach()

Preface In front-end development, we often encoun...

HTML uses regular expressions to test table examples

Here is an example code for using regular express...

How to install binary MySQL on Linux and crack MySQL password

1. Make sure the system has the required libaio s...

Detailed steps for installing Harbor, a private Docker repository

The installation of Harbor is pretty simple, but ...

Example of converting webpack images to base64

Download url-loader yarn add -D url-loader module...

Detailed steps for deploying Tomcat server based on IDEA

Table of contents Introduction Step 1 Step 2: Cre...

12 Useful Array Tricks in JavaScript

Table of contents Array deduplication 1. from() s...

Detailed process of building mongodb and mysql with docker-compose

Let's take a look at the detailed method of b...

Solve the problem of using linuxdeployqt to package Qt programs in Ubuntu

I wrote some Qt interface programs, but found it ...

Solution to nginx not jumping to the upstream address

Preface Today I encountered a very strange proble...

Detailed tutorial on installing harbor private warehouse using docker compose

Overview What is harbor? The English word means: ...

Summary of Mysql update multi-table joint update method

Next, I will create two tables and execute a seri...

Detailed tutorial on setting password for MySQL free installation version

Method 1: Use the SET PASSWORD command MySQL -u r...