MySQL 5.7 deployment and remote access configuration under Linux

MySQL 5.7 deployment and remote access configuration under Linux

Preface: Recently I am going to team up with my partners to work on a .NET Core project. So I rented an Alibaba Cloud server and installed Linux and MySQL. My Linux here is CentOs 7.

The first step is to add the Mysql Yum library

Here you need to go to the official website to get a specific rpm package. I chose the following package

Transfer the RPM package to the Opt directory on the Linux server through Xshell and enter the command: sudo rpm -Uvh mysql80-community-release-fc28-1.noarch.rpm

The second step is to select the version you need (default 8.0)

Here we manually configure it to version 5.7 and enter the following command:

sudo yum-config-manager --disable mysql80-community
sudo yum-config-manager --enable mysql57-community

Then enter the view command to see the following picture:

yum repolist all | grep mysql

Here you may be prompted that the yum-config-manager command is not installed. Don’t worry, this command is in the yum-utils package and can be installed using the command yum -y install yum-utils.

You can also modify the /etc/yum.repos.d/mysql-community.repo file to achieve the same effect.

Step 3 Install Mysql

sudo yum install mysql-community-server

Step 4: Start the Mysql service

sudo service mysqld start

You can check the status of the service with sudo service mysqld status

Step 5 Log in to MySql

mysql -uroot -p found that I need to enter a password but I don’t know it.

In fact, when installing MySQL, a password is set for us by default, and the Password Validation Component is installed, which performs policy checks on the password.

We can view the default password by entering sudo grep 'temporary password' /var/log/mysqld.log

mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
mysql>Flush Privileges;

This way we can log in with the new password.

Step 6 Authorize MySql remote login

Method 1: Modify the host of the user table in the MySQL database.

mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
mysql>Flush Privileges;

Method 2: Authorize remote IP

mysql>GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES

Then you can access it with Navicat:

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Deploy Apache+Python+Django+MySQL environment on Linux system
  • Detailed steps for remote deployment of MySQL database on Linux

<<:  How to deploy nginx with Docker and modify the configuration file

>>:  A brief discussion on how to write beautiful conditional expressions in JS

Recommend

How does MySQL achieve master-slave synchronization?

Master-slave synchronization, also called master-...

MySQL 8.0.11 installation summary tutorial diagram

Installation environment: CAT /etc/os-release Vie...

How to view the creation time of files in Linux

1. Introduction Whether the creation time of a fi...

SQL Practice Exercise: Online Mall Database Product Category Data Operation

Online shopping mall database-product category da...

js implements the algorithm for specifying the order and amount of red envelopes

This article shares the specific code of js to im...

17 404 Pages You'll Want to Experience

How can we say that we should avoid 404? The reas...

Summarize several common ranking problems in MySQL

Preface: In some application scenarios, we often ...

Introduction to new features of ECMAscript

Table of contents 1. Default values ​​for functio...

VMware installation of Ubuntu 20.04 operating system tutorial diagram

Memo: Just experience it. Record: NO.209 This exa...

Summary of knowledge points about covering index in MySQL

If an index contains (or covers) the values ​​of ...

Do you know the weird things in Javascript?

Our veteran predecessors have written countless c...

How to use TypeScript in Vue

introduction In recent years, the call for TypeSc...

Detailed explanation of JavaScript state container Redux

Table of contents 1. Why Redux 2. Redux Data flow...