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 to install and modify the initial password of mysql5.7.18

For Centos installation of MySQL, please refer to...

Troubleshooting and solutions for MySQL auto-increment ID oversize problem

introduction Xiao A was writing code, and DBA Xia...

Pure CSS3 code to implement a running clock

Operation effectCode Implementation html <div ...

How to understand Vue's simple state management store mode

Table of contents Overview 1. Define store.js 2. ...

Why MySQL chooses Repeatable Read as the default isolation level

Table of contents Oracle Isolation Levels MySQL I...

(MariaDB) Comprehensive explanation of MySQL data types and storage mechanisms

1.1 Data Type Overview The data type is a field c...

Detailed explanation of three commonly used web effects in JavaScript

Table of contents 1 element offset series 1.1 Off...

Sample code for partitioning and formatting a disk larger than 20TB on centos6

1. Server environment configuration: 1. Check dis...

Nginx merges request connections and speeds up website access examples

Preface As one of the best web servers in the wor...

HTML table mouse drag sorting function

Effect picture: 1. Import files <script src=&q...

Several mistakes that JavaScript beginners often make

Table of contents Preface Confusing undefined and...