Get the App
SLTechnology News&Howtos  ›  Database  › 

How to set mysql to disable remote connections

Shulou Source: shulou.com Published: 2022-06-01 03:16:37 09月23日 Update

Editor to share with you how to set mysql to prohibit remote connections, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Mysql setting forbids remote connection methods: 1, log in to the database server, specify mysql database; 2, execute [update user set host='localhost' where user='root';] statement; 3, refresh permission table.

Specific steps:

Use mysql # Open mysql database # setting host to localhost means that only local connections can be made to mysql update user set host='localhost' where user='root'; flush privileges; # refresh permissions table to make the configuration effective

If we want to open a remote connection, we can refer to the following method:

Log in first:

Mysql-u root-h localhost-puse mysql # Open mysql database # setting host to% means that any ip can connect to mysql. Of course, you can also specify host as an ipupdate user set host='%' where user='root' and host='localhost';flush privileges; # refresh permission table to make the configuration effective.

When it's done, we can connect to our mysql remotely.

The above is how to set up mysql to prohibit remote connection of all the content, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Data database permissions content methods articles references login configuration not much most more servers steps knowledge industry statements information information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Xiaomi Linux Docker OPPO Reno