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

Mysql adds remote access to the database

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

@ font-face {font-family: "Song style";} @ font-face {font-family: "Cambria Math";} @ font-face {font-family: "@ Song style";} @ font-face {font-family: "Calibri";} @ font-face {font-family: "Helvetica Neue";} p.MsoNormal, li.MsoNormal, div.MsoNormal {margin: 2000; text-align: justify; font-size: 14px; font-family: Calibri;} h4 {margin: 17px 0; text-align: justify Line-height: 172%; page-break-after: avoid; font-size: 21px; font-family: Calibri; font-weight: bold;} a:link, span.MsoHyperlink {color: blue; text-decoration: underline;} a:visited, span.MsoHyperlinkFollowed {color: rgb (149,79,114); text-decoration: underline;} p {margin-right: 0; margin-left: 0; font-size: 16px; font-family: Calibri;}. MsoChpDefault {font-size: 13px } div.WordSection1 {} ol {margin-bottom: 0;} ul {margin-bottom: 0;}

1. The problem that MySQL can be connected by localhost, but not by IP (remote access to database)

If, when deploying the project, you find that the database cannot be accessed remotely through Navicat, or if the database IP address is modified in the configuration file of the program, but cannot be accessed, try changing the configuration file to localhost to access it again. At this time, if localhost is accessible, you need to execute the following SQL statement to enable the remote login permission of the current login account.

1. Log in to mysql database as root user.

two。 Execute the following command to assign new users:

Grant all privileges on *. * to 'username' @'IP address' identified by 'password'

'all privileges': all permissions can also be written as select, update, etc.

*. * all tables of all libraries, such as databasename.*.

The IP where the IP database is located. ('% 'represents all ip)

Identified by 'password' means to connect through a password.

3. After executing the above command, refresh the permissions with the following command

Flush privileges

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