Get the App
SLTechnology News&Howtos  ›  Database  › 

How to realize remote access by Mysql

Shulou Source: shulou.com Published: 2022-05-31 18:48:34 09月10日 Update

This article mainly explains "how to achieve remote access in Mysql". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to achieve remote access in Mysql".

The database installed on the local machine can be accessed by the local program, but the colleague's machine is unable to connect and access. It is found that the mysql database does not open remote access.

The solution is as follows:

My database mysql root user password = cx, enter mysql-u root to enter mysql

There are three ways to allow mysql remote access:

A, change the table.

Java code

Use mysql

Update user set host ='% 'where user =' root'

Select host, user from user

B, authorization.

For example, let root users connect to the mysql server from any host.

Java code

GRANT ALL PRIVILEGES ON *. * TO IDENTIFIED BY 'cx' WITH GRANT OPTION

If you allow user test to connect to the mysql server from a host with an ip of 10.40.207.17 and use cx as the password

Java code

GRANT ALL PRIVILEGES ON *. * TO IDENTIFIED BY 'cx' WITH GRANT OPTION

LUSH RIVILEGES

C: run on the machine where mysql is installed:

/ / enter the MySQL server

Java code

Mysql-h localhost-u root

/ give any host permission to access data

GRANT ALL PRIVILEGES ON *. * TO WITH GRANT OPTION

/ / make the changes effective

FLUSH PRIVILEGES

/ / exit the MySQL server

EXIT

Thank you for your reading, the above is the content of "how to achieve remote access in Mysql". After the study of this article, I believe you have a deeper understanding of how to achieve remote access in Mysql, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Code data server service host database machine user learning content password method can make colleagues that is ideas situations articles ways more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Redmi Linux OPPO Reno Apple