Needless to say, create a view. After the SQL is written, click on the new view in the Navicat tool and paste it in.
In the Mysql5 version, we can complete the process of creating users and authorizing directly with one sentence of SQL
grant select on db.table to name@'%' identified by 'password';
However, in the Mysql8 version, creating users and granting permissions are separated, so using it will report a syntax error
You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near
So we're going to do it separately
First of all, don’t forget to change root’s host to %
update user set host=’%’ where user=‘root’;
Otherwise, an error will be reported
You are not allowed to create a user with GRANT
The first step is to create a user
create USER 'name'@'%' identified by 'password';
The second step is to grant permissions
GRANT SELECT,SHOW VIEW ON 'db'.'view' TO 'name'@'%'
The third step is to refresh the permissions
flush privileges;
Then you're done, just log in with the created user