Home > Database > Mysql Tutorial > How does Mysql set a user-specified IP address to operate the database?

How does Mysql set a user-specified IP address to operate the database?

coldplay.xixi
Release: 2020-09-28 11:25:47
Original
4154 people have browsed it

Mysql method to set the user-specified IP address to operate the database: use the grant function, the syntax is [grant priv_type on mysql.user to 'user'@'host' identified by 'password' with].

How does Mysql set a user-specified IP address to operate the database?

Mysql method of setting user-specified IP address to operate the database:

Syntax:

grant priv_type on mysql.user to 'user'@'host' identified by 'password' with grant option;
Copy after login
  • priv_type: represents the permission allowed to operate the database

  • user: represents the database user name

  • host: represents the IP address

  • password: represents the password set

刷新user权限表:flush privileges;
Copy after login

3. Case

1. Set all databases, all tables, any IP You can connect to the database, authorize the username ping and set the password to 123456

grant all on *.* to 'ping'@'%' identified by '123456';
flush privileges;
Copy after login

2. The authorization table cloud record modification permission gives the connection IP address is 192.168.100.1 and the username is ping and the password is 123456

grant update(name,sex) on cloud to 'ping'@'192.168.100.1' identified by '123456';
flush privileges;
Copy after login

4. View the database permission table

mysql> select * from mysql.user where host='localhost'\G;
*************************** 1. row ***************************
                 Host: localhost
                 User:
             Password:
          Select_priv: N
          Insert_priv: N
          Update_priv: N
          Delete_priv: N
          Create_priv: N
            Drop_priv: N
          Reload_priv: N
        Shutdown_priv: N
         Process_priv: N
            File_priv: N
           Grant_priv: N
      References_priv: N
           Index_priv: N
           Alter_priv: N
         Show_db_priv: N
           Super_priv: N
Create_tmp_table_priv: N
     Lock_tables_priv: N
         Execute_priv: N
      Repl_slave_priv: N
     Repl_client_priv: N
     Create_view_priv: N
       Show_view_priv: N
  Create_routine_priv: N
   Alter_routine_priv: N
     Create_user_priv: N
           Event_priv: N
         Trigger_priv: N
             ssl_type:
           ssl_cipher:
          x509_issuer:
         x509_subject:
        max_questions: 0
          max_updates: 0
      max_connections: 0
 max_user_connections: 0
Copy after login

More related free learning recommendations: mysql tutorial (video)

The above is the detailed content of How does Mysql set a user-specified IP address to operate the database?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template