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

Allow remote hosts to access the database

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1. Preface when you first install mysql, when you look at the user table. You can see the following hosts and users. When we connect in, we use root@localhost. But if you use other Host and user login, there is no way to log in successfully. Br/ > when you first install mysql, when you look at the user table. You can see the following hosts and users. When we connect in, we use root@localhost. But if you use other Host and user login, there is no way to log in successfully.

2. Add new users and grant permissions

The current version of mysql8.0 cannot directly use the grant command to add users, otherwise an error will be reported.

I don't know if I need to set anything, or there is something wrong with my command, please point out, thank you.

(1) you can use the following command to create a user

CREATE USER 'root'@'192.168.204.1' IDENTIFIED BY' 123456'

The names of the users here can be chosen at will.

The following IP, which can be%, represents all IP addresses.

You can also write IP alone, which is your own IP address.

If you are a virtual machine, it is usually the IP of x.x.x.1.

(2) then grant permissions

Grant all privileges on. To 'root'@'192.168.204.1'

Here I grant all permissions to this user @ host.

(3) then refresh

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