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

What is the statement to connect to MySQL in the local area network

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

Share

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

This article introduces the relevant knowledge of "what is the statement to connect MySQL in the local area network". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

We all know that the common statement used to connect to MySQL is

Jdbc:://localhost:3306/database

But when you want to connect to the mysql on other machines, it is useless to change the localhost of the above statement to the corresponding ip, because the default open connection permission for Mysql is localhost. When you need to connect to other machines, you need the MySQL on other machines to open other ip connections except the local one.

To connect to MySQL in a local area network, the first step is to open a remote connection to MySQL. Execute the following command on the MySQL command line on the MySQL server: www.2cto.com

Sql code

Grant all privileges on *. * to root@ "%" identified by '123' with grant option

Flush privileges

It means to give all permissions to users who connect from any ip address with a user name of root and a password of 123. The "%" is any ip address, or you can set it to a specific value if you want.

After executing this statement, you can access the machine as root:123 on other machines.

This is the end of the content of "what is the statement to connect MySQL in the local area network". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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