Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure remote access for mysql 5.7 in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How do I configure remote access for mysql 5.7 in Linux? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

The first step is to add Mysql Yum libraries

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

Transfer the RPM package via Xshell to the Opt directory on the Linux server, 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 version 5.7 and enter the following command:

Sudo yum-config-manager-disable mysql80-communitysudo yum-config-manager-enable mysql57-community

Then enter the view command and you can see the following figure:

Yum repolist all | grep mysql

This may prompt you not to install the yum-config-manager command, never mind that this command is in the yum-utils package, you can install it by 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 a password was required but did not know it.

In fact, when we install mysql, we are given a password by default and Password Validation Component is installed. This component will verify the password by policy.

We can check the default password by typing sudo grep 'temporary password' / var/log/mysqld.log.

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPass4 destroy MySQL > Flush Privileges

So we can log in with the new password.

Step 6 authorize MySql to log in remotely

Method 1: modify the host of user table in 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

So you can use Navicat to access:

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report