Database access method and device, electronic equipment and storage medium

By embedding a lightweight directory access protocol login component into the database management tool and using a login authentication server to verify user information, the problems of cumbersome database access processes and user information leakage are solved, achieving secure and efficient database access.

CN119272297APending Publication Date: 2025-01-07CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411279847.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

Existing database management systems pose a risk of database user information leakage when accessing data, and the access process is cumbersome.

Method used

By embedding a lightweight directory access protocol login component into the database management tool, the login authentication server verifies the target login authentication information entered by the user. If the verification is successful, the database user information is obtained and the database is accessed, avoiding the need to directly enter the database user information.

Benefits of technology

It speeds up the database access process, improves security, avoids the risk of database user information leakage, and simplifies the access process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119272297A_ABST
    Figure CN119272297A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and provides a database access method and device, electronic equipment and a storage medium. The method comprises the following steps: displaying a light directory access protocol login component embedded in a database management tool through an interactive interface; in response to target login authentication information input by the user through the light directory access protocol login component, verifying the target login authentication information through the login authentication server; and if the target login authentication information passes the verification, accessing a database management tool, acquiring database user information corresponding to the target login authentication information, and accessing a database according to the database user information. According to the method, the database management tool can be accessed, the database is accessed according to the corresponding database user information, the database user information does not need to be input, and the safety of the database user information is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a database access method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of computer application technology, the amount of data has exploded, and building a database has become a common means of managing massive data. Common database types include but are not limited to MySQL, MariaDB, PostgreSQL, SQLite, Oracle, SQL Server, and MongoDB.

[0003] In order to effectively manage these databases, database management systems (DBMS) came into being. DBMS is an essential tool for database administrators and developers. They provide rich functions and friendly user interfaces, making database management more convenient and efficient.

[0004] However, existing database management systems usually rely on user information in the database itself for identity authentication, which brings potential risks of user information leakage. Summary of the invention

[0005] In view of this, embodiments of the present application provide a database access method, device, electronic device and storage medium to solve the problem in the prior art that there is a risk of database user information leakage when a database management system accesses data.

[0006] According to a first aspect of an embodiment of the present application, a database access method is provided, which includes: displaying a lightweight directory access protocol login component embedded in a database management tool through an interactive interface; in response to target login authentication information input by a user through the lightweight directory access protocol login component, verifying the target login authentication information through a login authentication server; if the verification of the target login authentication information is successful, accessing the database management tool and obtaining database user information corresponding to the target login authentication information, and accessing the database according to the database user information.

[0007] According to a second aspect of an embodiment of the present application, a database access device is provided, which includes: an interactive module for displaying a lightweight directory access protocol login component embedded in a database management tool through an interactive interface; a verification module for responding to target login authentication information input by a user through the lightweight directory access protocol login component, and verifying the target login authentication information through a login authentication server; an access module for accessing the database management tool if the verification of the target login authentication information is successful, and obtaining database user information corresponding to the target login authentication information, and accessing the database according to the database user information.

[0008] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0009] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0010] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the method in the embodiments of the present application displays a lightweight directory access protocol login component embedded in a database management tool through an interactive interface; in response to target login authentication information input by a user through the lightweight directory access protocol login component, the target login authentication information is verified through a login authentication server; if the verification of the target login authentication information is successful, the database management tool is accessed, and database user information corresponding to the target login authentication information is obtained, and the database is accessed according to the database user information, wherein, after the login authentication server verifies the target login authentication information, the method can access the database management tool and access the database according to the corresponding database user information, thereby speeding up the database access process and avoiding the problem that the database user information needs to be entered for verification after logging into the database management tool, and the database can be accessed only after the verification is passed, resulting in a cumbersome database access process; and the method does not require the input of database user information, thereby ensuring the security of the database user information and avoiding the problem that in the related art, the database management system usually relies on the user information of the database itself for identity authentication, resulting in the risk of database user information leakage when the database management system accesses data. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0012] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0013] Figure 2 It is a flowchart of a database access method provided by an embodiment of the present application;

[0014] Figure 3 It is a flowchart of another database access method provided in an embodiment of the present application;

[0015] Figure 4 It is a flowchart of another database access method provided in an embodiment of the present application;

[0016] Figure 5 It is a flowchart of another database access method provided in an embodiment of the present application;

[0017] Figure 6 It is a flowchart of another database access method provided in an embodiment of the present application;

[0018] Figure 7 It is a flowchart of another optional database access method provided in an embodiment of the present application;

[0019] Figure 8 It is a flowchart of another optional database access method provided in an embodiment of the present application;

[0020] Fig. 9 It is a flowchart of another optional database access method provided in an embodiment of the present application;

[0021] Fig.10 It is a structural diagram of a database access device provided in an embodiment of the present application;

[0022] Fig.11 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0024] A database access method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0025] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario may include terminal devices 1, 2 and 3, a server 4 and a network 5.

[0026] Terminal devices 1, 2 and 3 can be hardware or software. When terminal devices 1, 2 and 3 are hardware, they can be various electronic devices with display screens and supporting communication with server 4, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when terminal devices 1, 2 and 3 are software, they can be installed in the above electronic devices. Terminal devices 1, 2 and 3 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present application are not limited to this. Furthermore, various applications can be installed on terminal devices 1, 2 and 3, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.

[0027] The server 4 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with the server, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server 4 may be a single server, a server cluster composed of several servers, or a cloud computing service center, which is not limited in the present application.

[0028] It should be noted that the server 4 can be hardware or software. When the server 4 is hardware, it can be various electronic devices that provide various services for the terminal devices 1, 2, and 3. When the server 4 is software, it can be multiple software or software modules that provide various services for the terminal devices 1, 2, and 3, or it can be a single software or software module that provides various services for the terminal devices 1, 2, and 3, and the embodiments of the present application are not limited to this.

[0029] The network 5 can be a wired network connected by coaxial cable, twisted pair and optical fiber, or it can be a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present application.

[0030] The user can establish a communication connection with the server 4 via the network 5 through the terminal devices 1, 2 and 3 to receive or send information, etc.

[0031] It should be noted that the specific types, quantities and combinations of the terminal devices 1, 2 and 3, the server 4 and the network 5 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present application do not limit this.

[0032] Figure 2 A database access method provided by an embodiment of the present application is as follows: Figure 2 As shown, the method includes:

[0033] S201, displaying a lightweight directory access protocol login component embedded in a database management tool through an interactive interface;

[0034] S202, in response to the target login authentication information input by the user through the lightweight directory access protocol login component, verifying the target login authentication information through the login authentication server;

[0035] S203: If the target login authentication information is verified, access the database management tool, obtain the database user information corresponding to the target login authentication information, and access the database according to the database user information.

[0036] It can be understood that the database access method provided in this example is applied to a database management system, which includes a database management server, a login authentication server, and a client, where the client is an electronic device that issues an access request corresponding to a database management tool.

[0037] Specifically, when a user has a need to access a database or a need to access a database management tool, an access request can be issued through any electronic device, and the database management system responds to the access request by displaying the database management tool through the client's interactive interface; wherein, since a lightweight directory access protocol login component is embedded in the user interface of the database management tool, when the client displays the user interface of the database management tool, it will also display the lightweight directory access protocol login component embedded in the database management tool.

[0038] For example, taking PHPMyAdmin as the above-mentioned database management tool, a lightweight directory access protocol login component (LDAP) is embedded in PHPMyAdmin. When a user accesses the user interface of PHPMyAdmin through a browser of any electronic device, the electronic device is used as a client, and the user interface of PHPMyAdmin embedded with LDAP is displayed through the client.

[0039] In some examples, a user can input target login authentication information for user identity authentication through the above-mentioned lightweight directory access protocol login component. After receiving the above-mentioned target login authentication information, the lightweight directory access protocol login component transmits the target login authentication information to the bound login authentication server (LDAP server), and the login authentication server is used to verify the above-mentioned target login authentication information; it can be understood that the target login authentication information consists of a user name and a password.

[0040] In some examples, if the verification of the target login authentication information is successful, it indicates that the user currently has the qualifications to use the database management tool and access the database. Therefore, if the verification of the target login authentication information is successful, this example will access the database management tool, obtain the database user information corresponding to the target login authentication information, so that the database management tool accesses the database according to the database user information, and displays the database management tool and the data obtained by accessing the database through the client; conversely, if the verification of the target login authentication information is not successful, it indicates that the user is not qualified to use the database management tool, and at this time the database management tool will not be accessed, nor will the database user information corresponding to the target login authentication information be obtained to try to access the database.

[0041] Exemplarily, taking the database management tool PHPMyAdmin as an example, this example first displays the Lightweight Directory Access Protocol login component in the user interface of the database management tool through an interactive interface, and then responds to the target login authentication information entered by the user through the Lightweight Directory Access Protocol login component, verifies the target login authentication information through the login authentication server. If the verification of the target login authentication information passes, it is determined that the user is qualified to use PHPMyAdmin. At this time, the client will access PHPMyAdmin and obtain the database user information corresponding to the target login authentication information, and access the database according to the database user information.

[0042] According to the technical solution provided in the embodiment of the present application, a lightweight directory access protocol login component embedded in a database management tool is displayed through an interactive interface; in response to the target login authentication information input by the user through the lightweight directory access protocol login component, the target login authentication information is verified through the login authentication server; if the verification of the target login authentication information is successful, the database management tool is accessed, and the database user information corresponding to the target login authentication information is obtained, and the database is accessed according to the database user information, wherein, after the login authentication server verifies the target login authentication information, the method can access the database management tool and access the database according to the corresponding database user information, thereby speeding up the database access process and avoiding the problem that the database user information needs to be entered for verification after logging into the database management tool, and the database can be accessed only after the verification is passed, resulting in a cumbersome database access process; and the method does not need to enter the database user information, thereby ensuring the security of the database user information and avoiding the problem that in the related art, the database management system usually relies on the user information of the database itself for identity authentication, resulting in the risk of database user information leakage when the database management system accesses data.

[0043] In some embodiments, Figure 3As shown, the lightweight directory access protocol login component embedded in the database management tool is displayed through an interactive interface, including:

[0044] S301, obtaining connection parameters corresponding to the login authentication server, and obtaining a configuration file corresponding to the database management tool;

[0045] S302, adding connection parameters in the configuration file to embed the Lightweight Directory Access Protocol login component in the database management tool;

[0046] S303: In response to the access request to the database management tool, display the lightweight directory access protocol login component embedded in the database management tool through an interactive interface.

[0047] This example first embeds the Lightweight Directory Access Protocol login component in a database management tool; specifically, obtains connection parameters corresponding to the login authentication server (LDAP server), including but not limited to: LDAP server address, port number, binding user and binding password.

[0048] This example also obtains the configuration file corresponding to the database management tool and adds the above connection parameters to the configuration file so that the lightweight directory access protocol login component is embedded in the database management tool. When the user subsequently makes an access request, the login interface of the database management tool can display the embedded lightweight directory access protocol login component.

[0049] For example, taking the database management tool PHPMyAdmin as an example, add the connection parameters of the LDAP server in the configuration file config.inc.php of phpMyAdmin, and the connection parameters include the server address, port number, binding user DN and binding password. The exemplary code is as follows:

[0050] $i=0;

[0051] $i++;

[0052] $cfg['Servers'][$i]['auth_type']='ldap';

[0053] $cfg['Servers'][$i]['ldap_host']='ldap: / / ldap-server';

[0054] $cfg['Servers'][$i]['ldap_port']=389;

[0055] $cfg['Servers'][$i]['ldap_base_dn']='dc=example,dc=com';

[0056] $cfg['Servers'][$i]['ldap_bind_dn']='cn=admin,dc=example,dc=com';

[0057] $cfg['Servers'][$i]['ldap_bind_password']='admin_password';

[0058] Among them, $cfg is the configuration item in phpmyadmin, and $i represents multi-environment management, which is the number of MySQL servers.

[0059] Where ldap_host is the address of the LDAP server, which is used to specify which LDAP server phpMyAdmin should connect to. ldap_host is the IP address or domain name of the LDAP server. ldap_port is the port number used to connect to the LDAP server. Set the port number to 389.

[0060] ldap_base_dn,This is the root node for storing information in the LDAP directory, which is used to define the namespace of the directory. For example, in an enterprise, this may be the company's domain name,ldap_bind_dnThis is a user with permissions used to perform operations on the LDAP server, such as searching and authentication. This user must have permission to access and search user entries in the directory,ldap_bind_passwordThis is the password of the ldap_bind_dn user, used for authentication and authorization operations.

[0061] In the above code, $i is a counter used to manage multiple MySQL servers or environments that phpMyAdmin can connect to. $i++ is used to increment $i, indicating that the current configuration is for the first server; $cfg['Servers'][$i]['auth_type'] = 'ldap' defines the authentication method for phpMyAdmin. Setting 'auth_type' to 'ldap' means that phpMyAdmin will authenticate users via LDAP (Lightweight Directory Access Protocol) instead of using the traditional MySQL username and password authentication method; $cfg['Servers'][$i]['ldap_host'] = 'ldap: / / ldap-server' specifies the address of the LDAP server. 'ldap: / / ldap-server' is the URL of the LDAP server, usually the IP address or domain name of the LDAP server. ldap: / / is the prefix of the LDAP protocol, and ldap-server is the domain name or IP address of the server. $cfg['Servers'][$i]['ldap_port'] = 389 sets the default port number for LDAP to 389. $cfg['Servers'][$i]['ldap_base_dn'] = 'dc = example, dc = com' The code is ldap_base_dn specifies the base DN (Distinguished Name) of the LDAP directory. 'dc = example, dc = com' means the domain with base DN example.com. All LDAP searches will start from this base DN; $cfg['Servers'][$i]['ldap_bind_dn'] = 'cn = admin, dc = example, dc = com' The code ldap_bind_dn is the user DN (Distinguished Name) used to bind to the LDAP server. Here, 'cn = admin, dc = example, dc = com' means to bind using the administrator account, cn = admin is the Common Name, and dc = example, dc = com is the domain to which the administrator belongs. $cfg['Servers'][$i]['ldap_bind_password'] = 'admin_password' In the code, ldap_bind_password is the password of the bind user. Here, 'admin_password' is the password of the administrator account, which is used for identity authentication to ensure that phpMyAdmin can connect to the LDAP server and perform authentication operations.

[0062] Finally, this example responds to an access request to the database management tool by displaying the lightweight directory access protocol login component embedded in the database management tool login interface through an interactive interface; it can be understood that the above access request can be issued by the user through the browser of any electronic device.

[0063] According to the technical solution provided in the embodiment of the present application, the connection parameters corresponding to the login authentication server are obtained, and the configuration file corresponding to the database management tool is obtained; the connection parameters are added to the configuration file to embed the Lightweight Directory Access Protocol login component in the database management tool; in response to an access request to the database management tool, the Lightweight Directory Access Protocol login component embedded in the database management tool is displayed through an interactive interface. The above-mentioned method embeds the Lightweight Directory Access Protocol login component in the database management tool, and then when an access request from the database management tool is received, it is possible to display the Lightweight Directory Access Protocol login component embedded in the database management tool through the interactive interface.

[0064] In some embodiments, Figure 4 As shown, the target login authentication information is verified through the login authentication server, including:

[0065] S401, transmitting the target login authentication information to the login authentication server, so that the login authentication server verifies the target login authentication information through the stored login authentication information;

[0066] S402: If the login authentication server confirms that the target login authentication information has been authenticated, it returns authentication pass information to the database management server.

[0067] The login authentication server of this example stores at least one login authentication information. When receiving the target login authentication information, the login authentication server will first obtain the user name carried in the target login authentication information, and use the user name to query whether the user name exists in the login authentication server. If the user name does not exist in the login authentication server, it will prompt that the account does not exist, and display the information that the account does not exist through the Lightweight Directory Access Protocol login component; if the user name exists in the login authentication server, the password carried in the target login authentication information is compared with the password corresponding to the user name in the login authentication server. If they are the same, the login authentication server confirms that the target login authentication information has been verified; if they are different, the login authentication server confirms that the target login authentication information has not been verified, and displays the information that the account password is wrong through the Lightweight Directory Access Protocol login component.

[0068] In some examples, if the login authentication server confirms that the target login authentication information has passed the verification, it returns the verification pass information to the database management server, so that the database management server can subsequently obtain the corresponding database user information based on the target login authentication information; if the login authentication server confirms that the target login authentication information has not passed the verification, it transmits the verification failure information to the database management server, so that the database management server will not obtain the database user information corresponding to the target login authentication information; in some examples, if the login authentication server confirms that the target login authentication information has not passed the verification, it will not transmit any information to the database management server, so that the database management server will not obtain the database user information corresponding to the target login authentication information.

[0069] In order to better understand the above method, this embodiment provides a more specific example for illustration, wherein taking the database management tool phpMyAdmin as an example, in response to the user's access request to the database management tool, this example displays the Lightweight Directory Access Protocol login component embedded in the database management tool through an interactive interface. After the user enters the target login authentication information through the Lightweight Directory Access Protocol login component, this example connects to the LDAP server (LDAP server) through the connection function between the Lightweight Directory Access Protocol login component and the login authentication server to authenticate the target login authentication information.

[0070] Specifically, the target login authentication information entered by the user will be passed to the LDAP server for identity authentication. If the identity authentication is successful, phpMyAdmin will allow the user to access and set corresponding permissions based on the information returned by the LDAP server; that is, this solution integrates the Lightweight Directory Access Protocol login component into phpMyAdmin by defining a login authentication function. The Lightweight Directory Access Protocol login component is used to receive the target login authentication information (user name and password) and return a Boolean value to indicate whether the authentication is successful. When the Boolean value is true, it means that the verification of the target login authentication information is passed. When the Boolean value is false, it means that the verification of the target login authentication information has failed. In this way, different login feedback can be set according to the Boolean value.

[0071] The example code is as follows:

[0072]

[0073]

[0074] Among them, function customLdapAuth($username,$password){global$cfg} defines a PHP function customLdapAuth in the code, which is used to handle the user's LDAP login authentication. It receives two parameters: $username and $password. global$cfg; is used to reference the global variable $cfg, which stores the configuration information of phpMyAdmin. $ldap_conn=ldap_connect($cfg['Servers'][1]['ldap_host'],$cfg['Servers'][1]['ldap_port']) connects to the LDAP server through the ldap_connect function. $cfg['Servers'][1]['ldap_host'] is the address of the LDAP server, and $cfg['Servers'][1]['ldap_port'] is the port number of the LDAP server. They are read from the phpMyAdmin configuration file config.inc.php; if(!$ldap_conn){die('Could not connect to LDAP server.');} The code is an error handler. Used to output an error message and terminate the program when unable to connect to the LDAP server; ldap_set_option($ldap_conn,LDAP_OPT_PROTOCOL_VERSION,3); ldap_set_option($ldap_conn,LDAP_OPT_REFERRALS,0) The code is to set LDAP options. LDAP_OPT_PROTOCOL_VERSION is set to 3, indicating that version 3 of the LDAP protocol is used; LDAP_OPT_REFERRALS is set to 0, indicating that LDAP referral tracking is disabled; $bind = ldap_bind($ldap_conn, $cfg['Servers'][1]['ldap_bind_dn'], $cfg['Server s'][1]['ldap_bind_password']); if(!$bind) {die('Could not bind to LDAP server.');} The code is used to try to bind to the LDAP server with the administrator user (ldap_bind_dn) and password (ldap_bind_password). After the binding is successful, the user can be searched.If the bind fails, an error message is output and the program is terminated; $filter = "(uid = $username)"; $result = ldap_search($ldap_conn, $cfg['Servers'][1]['ldap_base_dn'], $filter) The code defines a filter $filter, where $username is the user name entered by the user. The ldap_search function is used to search for entries matching the user name within the ldap_base_dn (base DN) range. if(!$result){die('LDAP search failed.');} The code is used to output an error message and terminate the program when the search fails; $entries = ldap_get_entries($ldap_conn, $result); if($entries['count'] == 0){return false;} The code obtains the search result through ldap_get_entries and stores it in $entries. If no entry matching the user name is found, $entries['count'] == 0, indicating that the user is not registered, and the function returns false, indicating that the authentication failed; $user_dn = $entries[0]['dn']; / / Attempt to bind with user DN and password $bind = ldap_bind($ldap_conn, $user_dn, $password) The code is used to obtain the user's DN (distinguished name) stored in $user_dn, and then use the user's DN and password to try to bind to the LDAP server again. If the bind is successful, it means that the user has provided the correct user name and password. if($bind) {return true;}else {return false;}} is used to return true when the user binds successfully, indicating that the user authentication is successful; otherwise, it returns false, indicating that the password is wrong or the authentication fails.

[0075] The main logic of the above code in this method is: 1. Connect to LDAP server; 2. Set LDAP options; 3. Bind to LDAP server; 4. Try to search for user DN and password; 5. User authentication.

[0076] It can be understood that after the verification is passed, the database management tool can be accessed and the database user information corresponding to the target login authentication information can be obtained, so that the database management tool can access the database according to the database user information.

[0077] According to the technical solution provided in the embodiment of the present application, the target login authentication information is transmitted to the login authentication server, so that the login authentication server verifies the target login authentication information through the stored login authentication information; if the login authentication server confirms that the target login authentication information has been verified, the verification pass information is returned to the database management server, thereby realizing the verification of the access qualification of the database management tool based on the login authentication server. Through the above method, user authentication based on the login authentication server is realized in the database management tool, and the efficiency and security of user management are improved by using a centralized authentication system.

[0078] In some embodiments, Figure 5 As shown, before verifying the target login authentication information through the login authentication server, the method also includes:

[0079] S501, accessing a login authentication server to determine whether the login authentication server stores login authentication information for verifying target login authentication information;

[0080] S502: If the login authentication information is not stored in the login authentication server, a registration prompt is displayed through a lightweight directory access protocol login component.

[0081] Specifically, in order to further optimize the efficiency of the login authentication server in verifying the target login authentication information, this example also needs to determine whether the login authentication server stores login authentication information for verifying the target login authentication information before verifying the target login authentication information through the login authentication server.

[0082] If the login authentication server does not store the login authentication information, the login authentication server will inevitably be unable to verify the target login authentication information. Figure 6 As shown, if the login authentication information is not stored in the login authentication server, the registration prompt is displayed through the Lightweight Directory Access Protocol login component. At this time, this example will not execute the step of verifying the target login authentication information through the login authentication server, thereby saving resources; if the login authentication information is stored in the login authentication server, the target login authentication information is verified normally. When the verification fails, it can be prompted that the verification failed, or it can be prompted that the password is wrong and needs to be re-entered; when the verification passes, it is confirmed that the login is successful, and the user can subsequently access the database management tool.

[0083] According to the technical solution provided in the embodiment of the present application, the login authentication server is accessed to determine whether the login authentication information used to verify the target login authentication information is stored in the login authentication server; if the login authentication information is not stored in the login authentication server, a registration prompt is displayed through a lightweight directory access protocol login component, thereby optimizing the login authentication server's verification efficiency for the target login authentication information and avoiding the problem of resource waste caused by executing the verification step when the login authentication information is not stored in the login authentication server.

[0084] In some embodiments, Figure 7 As shown, before obtaining the database user information corresponding to the target login authentication information and accessing the database according to the database user information, the method further includes:

[0085] S701, obtaining user access rights corresponding to a database, and generating a user information relationship table according to the user access rights, wherein the user information relationship table includes information of at least one database user who has access rights to the database;

[0086] S702: Acquire login authentication information stored in the login authentication server, and set a corresponding relationship between database user information and login authentication information in a user information relationship table.

[0087] This method involves a user information relationship table in the database, and the user information relationship table stores the corresponding relationship between database user information and login authentication information.

[0088] This method first obtains the user access rights corresponding to the database, and the user access rights are used to characterize the users who are qualified to access the database. Then, a user information table is generated according to the user access rights. The user information table includes at least one database user information that has access rights to the database. Specifically, the method obtains the database user information corresponding to each user in the user access rights, and then generates the user information table according to the database user information corresponding to each user.

[0089] In order to obtain the corresponding database user information after the subsequent target login authentication information is verified, this example also obtains the login authentication information stored in the login authentication server and sets the corresponding relationship between the database user information and the login authentication information in the user information relationship table.

[0090] Exemplarily, after obtaining the user access rights corresponding to the database, the user access rights indicate that the three users A, B, and C are qualified to access the database, then the database user information corresponding to the three users A, B, and C is obtained respectively, and a user information table containing the database user information of the three users A, B, and C is generated according to the database user information; the login authentication information stored in the login authentication server contains the three login authentication information of X, Y, and Z. In order to make the login authentication information stored in the login authentication server correspond to the database user information corresponding to the above three users A, B, and C, this example also obtains the login authentication information stored in the login authentication server and sets it in the user information relationship table. The correspondence between the database user information and the login authentication information is such that the database user information corresponding to user A corresponds to the login authentication information X, the database user information corresponding to user B corresponds to the login authentication information Y, and the database user information corresponding to user C corresponds to the login authentication information Z; after a subsequent user inputs the login authentication information X through the lightweight directory access protocol login component embedded in the database management tool, and after the login authentication information X is authenticated, the database user information corresponding to user A corresponding to the login authentication information X is obtained, so that the database management tool accesses the database according to the database user information corresponding to user A, and the same is true for the login authentication information Y and the login authentication information Z, which will not be repeated here.

[0091] According to the technical solution provided in the embodiment of the present application, the user access rights corresponding to the database are obtained, and a user information relationship table is generated according to the user access rights, wherein the user information relationship table contains at least one database user information having access rights to the database; the login authentication information stored in the login authentication server is obtained, and the correspondence between the database user information and the login authentication information is set in the user information relationship table, so that the target login authentication information and the database user information have an associated relationship, thereby realizing the acquisition of the database user information corresponding to the target login authentication information.

[0092] In some embodiments, Figure 8 As shown, accessing the database according to the database user information includes:

[0093] S801, obtaining a database access interface corresponding to the database, where the database access interface is used to verify database user information;

[0094] S802: When the database access interface confirms that the database user information verification has passed, access the database.

[0095] Specifically, in order to access the database, the database management server in this example obtains a database access interface corresponding to the database, and inputs the obtained database user information into the database access interface to verify the database user information.

[0096] When the database access interface confirms that the database user information verification is passed, the database management server can access the database, and the database management server can display the access result to the user through the database management tool.

[0097] It can be understood that the above steps are executed by the database management server without the need for user operation. That is, the user can access both the database management tool and the database by simply entering the target login authentication information through the Lightweight Directory Access Protocol login component, completely avoiding the exposure of database user information and shielding the database server address. Users can only access the database management tool and the database through the Lightweight Directory Access Protocol login component, which provides feasibility for subsequent desensitization and security review.

[0098] According to the technical solution provided in the embodiment of the present application, a database access interface corresponding to the database is obtained, and the database access interface is used to verify the database user information; when the database access interface confirms that the database user information verification is passed, the database is accessed, and the user only needs to enter the target login authentication information through the lightweight directory access protocol login component to access both the database management tool and the database, which completely avoids the exposure of the database user information and shields the server address of the database. The user can only access the database management tool and the database through the lightweight directory access protocol login component, which provides feasibility for subsequent desensitization and security review.

[0099] In some embodiments, Fig. 9 As shown, before displaying the lightweight directory access protocol login component embedded in the database management tool through an interactive interface, the method includes:

[0100] S901, obtaining the availability, connection response time and authentication failure rate of the login authentication server bound to the Lightweight Directory Access Protocol login component;

[0101] S902: If the availability, connection response time, and authentication failure rate of the login authentication server indicate that the login authentication server is abnormal, unbind the login authentication server from the Lightweight Directory Access Protocol login component;

[0102] S903: Acquire a backup authentication server, and use the backup authentication server as a new login authentication server to bind with the lightweight directory access protocol login component.

[0103] It is understandable that in order to avoid anomalies in the login authentication server, which may cause the login authentication server to be unable to verify the target login authentication information, this example will deploy at least one backup authentication server (backup LDAP server) for backup use to ensure that when the login authentication server bound to the Lightweight Directory Access Protocol login component is unavailable, the system can automatically switch to other backup authentication servers to avoid single point failures.

[0104] This example will obtain the availability, connection response time and authentication failure rate of the login authentication server bound to the Lightweight Directory Access Protocol login component; illustratively, this example sets a timed task (such as using cron or scheduler) to periodically try to connect to the login authentication service bound to the Lightweight Directory Access Protocol login component, and determine whether the connection is successful; if the connection is successful, it indicates that the availability of the login authentication service bound to the Lightweight Directory Access Protocol login component is available; if the connection fails, it indicates that the availability of the login authentication service bound to the Lightweight Directory Access Protocol login component is unavailable, records related errors, and triggers an alarm mechanism. Exemplarily, use the microtime() function (PHP) or other language time measurement functions to record the start time and end time of connecting to the login authentication server bound to the Lightweight Directory Access Protocol login component, and calculate the connection response time. Exemplarily, by counting the ratio of the number of failures to the total number of login attempts over a period of time, it is possible to obtain the authentication failure rate corresponding to the login authentication server.

[0105] In some examples, if the availability of the login authentication server is unavailable, it is determined that there is an abnormality in the login authentication server. Or, if the connection response time exceeds a preset response time threshold (such as 200ms), it is determined that there is an abnormality in the login authentication server; or, if the authentication failure rate exceeds a preset authentication failure threshold (such as 5%), it is determined that there is an abnormality in the login authentication server.

[0106] If the availability of the login authentication server is available, and the connection response time does not exceed a preset response time threshold (such as 200ms), and the authentication failure rate does not exceed a preset authentication failure threshold (such as 5%), it is determined that there is no abnormality in the login authentication server.

[0107] In some examples, if the availability, connection response time and authentication failure rate of the login authentication server indicate that there is an abnormality in the login authentication server, it is determined that the login authentication server is subsequently unable to verify the target login authentication information transmitted by the Lightweight Directory Access Protocol login component. In order to improve the availability of the Lightweight Directory Access Protocol login component, this example will unbind the login authentication server from the Lightweight Directory Access Protocol login component, and then obtain a backup authentication server, and use the backup authentication server as a new login authentication server to bind to the Lightweight Directory Access Protocol login component, so that the backup authentication server can be used as a new login authentication server to verify the target login authentication information transmitted by the Lightweight Directory Access Protocol login component.

[0108] According to the technical solution provided in the embodiment of the present application, the availability, connection response time and authentication failure rate of the login authentication server bound to the lightweight directory access protocol login component are obtained; if the availability, connection response time and authentication failure rate of the login authentication server indicate that there is an abnormality in the login authentication server, the login authentication server is unbound from the lightweight directory access protocol login component; a backup authentication server is obtained, and the backup authentication server is used as a new login authentication server to bind to the lightweight directory access protocol login component. This process does not require manual intervention, ensuring that the system can still successfully complete user authentication when the login authentication server fails, thereby improving the system's fault tolerance and service continuity. Through this solution, the system not only realizes automatic monitoring and fault switching of the authentication server, but also significantly improves the reliability of the authentication process, reducing service interruptions and user experience degradation caused by login authentication server failures.

[0109] In some examples, after accessing the database according to database user information, the method further includes: receiving a user's modification instruction for data in the database through a database management tool; modifying the data in the database in response to the modification instruction, and displaying the modification result through the database management tool.

[0110] When the database access interface confirms that the database user information verification has passed, the database management server can access the database, and the database management server can visually display the access results to the user through the database management tool, and the user can visually manage the data in the database. Specifically, in this application, the user's modification instructions for the data in the database are received through the database management tool, and the above modification instructions include any one or more of adding, deleting, checking, and modifying.

[0111] In some examples, the present example will also modify the data in the database in response to the modification instruction, and display the modification result through the database management tool, so that the user can visually and intuitively know the data modification result.

[0112] According to the technical solution provided in the embodiment of the present application, a user's modification instructions for data in a database are received through a database management tool; the data in the database is modified in response to the modification instructions, and the modification results are displayed through the database management tool, so that the user can visually manage the data in the database and the user can visually and intuitively know the data modification results.

[0113] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0114] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0115] This embodiment also provides a database access device, such as Fig.10 As shown, the device comprises:

[0116] An interactive module 1001 is used to display a lightweight directory access protocol login component embedded in a database management tool through an interactive interface;

[0117] Verification module 1002, for verifying the target login authentication information through a login authentication server in response to the target login authentication information input by the user through the lightweight directory access protocol login component;

[0118] The access module 1003 is used to access the database management tool if the verification of the target login authentication information is passed, and obtain the database user information corresponding to the target login authentication information, and access the database according to the database user information.

[0119] In some examples, the interactive module 1001 is also used to obtain connection parameters corresponding to the login authentication server and to obtain a configuration file corresponding to the database management tool; to add connection parameters to the configuration file to embed a lightweight directory access protocol login component in the database management tool; and to respond to an access request to the database management tool, to display the lightweight directory access protocol login component embedded in the database management tool through an interactive interface.

[0120] In some examples, the verification module 1002 is also used to transmit the target login authentication information to the login authentication server, so that the login authentication server verifies the target login authentication information through the stored login authentication information; if the login authentication server confirms that the target login authentication information is verified, it returns the verification pass information to the database management server.

[0121] In some examples, the verification module 1002 is also used to access the login authentication server to determine whether the login authentication server stores login authentication information for verifying the target login authentication information; if the login authentication server does not store the login authentication information, a registration prompt is displayed through the Lightweight Directory Access Protocol login component.

[0122] In some examples, access module 1003 is also used to obtain user access rights corresponding to the database, generate a user information relationship table based on the user access rights, the user information relationship table containing at least one database user information with access rights to the database; obtain login authentication information stored in the login authentication server, and set the correspondence between the database user information and the login authentication information in the user information relationship table.

[0123] In some examples, the access module 1003 is also used to obtain a database access interface corresponding to the database, and the database access interface is used to verify the database user information; when the database access interface confirms that the database user information verification is successful, the database is accessed.

[0124] In some examples, the access module 1003 is also used to receive a user's modification instruction for data in the database through a database management tool; modify the data in the database in response to the modification instruction, and display the modification result through the database management tool.

[0125] According to the technical solution provided by the embodiment of the present application, the database access device provided by the embodiment displays a lightweight directory access protocol login component embedded in a database management tool through an interactive interface; in response to the target login authentication information input by the user through the lightweight directory access protocol login component, the target login authentication information is verified through the login authentication server; if the verification of the target login authentication information is successful, the database management tool is accessed, and the database user information corresponding to the target login authentication information is obtained, and the database is accessed according to the database user information, wherein, after the login authentication server verifies the target login authentication information, the method can access the database management tool and access the database according to the corresponding database user information, thereby speeding up the database access process and avoiding the problem that the database user information needs to be entered for verification after logging into the database management tool, and the database can be accessed only after the verification is passed, resulting in a cumbersome database access process; and the method does not need to enter the database user information, thereby ensuring the security of the database user information and avoiding the problem that in the related art, the database management system usually relies on the user information of the database itself for identity authentication, resulting in the risk of database user information leakage when the database management system accesses data.

[0126] Fig.11 Schematic diagram of an electronic device 11 provided in an embodiment of the present application. Fig.11 As shown, the electronic device 11 of this embodiment includes: a processor 1101, a memory 1102, and a computer program 1103 stored in the memory 1102 and executable on the processor 1101. When the processor 1101 executes the computer program 1103, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 1101 executes the computer program 1103, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0127] The electronic device 11 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 11 may include, but is not limited to, a processor 1101 and a memory 1102. Those skilled in the art will appreciate that Fig.11 The electronic device 11 is merely an example and does not limit the electronic device 11 , and may include more or less components than those shown in the figure, or different components.

[0128] Processor 1101 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0129] The memory 1102 may be an internal storage unit of the electronic device 11, for example, a hard disk or memory of the electronic device 11. The memory 1102 may also be an external storage device of the electronic device 11, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (FlashCard), etc. equipped on the electronic device 11. The memory 1102 may also include both an internal storage unit of the electronic device 11 and an external storage device. The memory 1102 is used to store computer programs and other programs and data required by the electronic device.

[0130] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0131] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of regional requirements and patent practice. For example, in some areas, according to regional requirements and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.

[0132] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A database access method, characterized in that: The method comprises: Demonstrate the Lightweight Directory Access Protocol login component embedded in the database management tool through an interactive interface; In response to target login authentication information input by a user through the lightweight directory access protocol login component, verifying the target login authentication information through a login authentication server; If the login authentication server successfully verifies the target login authentication information, the database management tool is accessed to obtain the database user information corresponding to the target login authentication information, and the database is accessed according to the database user information.

2. The method according to claim 1, characterized in that Demonstrate the Lightweight Directory Access Protocol login component embedded in the database management tool through an interactive interface, including: Obtain connection parameters corresponding to the login authentication server, and obtain a configuration file corresponding to the database management tool; Adding the connection parameters in the configuration file to embed the lightweight directory access protocol login component in the database management tool; In response to an access request to the database management tool, the lightweight directory access protocol login component embedded in the database management tool is displayed through an interactive interface.

3. The method according to claim 1, characterized in that Verifying the target login authentication information through a login authentication server includes: Transmitting the target login authentication information to the login authentication server, so that the login authentication server verifies the target login authentication information through the stored login authentication information; If the login authentication server confirms that the target login authentication information has been authenticated, it returns authentication pass information to the database management server.

4. The method according to claim 3, characterized in that Before transmitting the target login authentication information to the login authentication server, the method further includes: Accessing the login authentication server to determine whether the login authentication server stores login authentication information for verifying the target login authentication information; If the login authentication information is not stored in the login authentication server, a registration prompt is displayed through the lightweight directory access protocol login component.

5. The method according to claim 1, characterized in that Obtaining database user information corresponding to the target login authentication information, and before accessing the database according to the database user information, the method further includes: Obtaining user access rights corresponding to the database, and generating a user information relationship table according to the user access rights, wherein the user information relationship table includes information of at least one database user who has access rights to the database; The login authentication information stored in the login authentication server is obtained, and the corresponding relationship between the database user information and the login authentication information is set in the user information relationship table.

6. The method according to claim 1, characterized in that Accessing a database according to the database user information includes: Obtaining a database access interface corresponding to the database, wherein the database access interface is used to verify the database user information; When the database access interface confirms that the database user information verification has passed, the database is accessed.

7. The method according to claim 1, characterized in that Before displaying the lightweight directory access protocol login component embedded in the database management tool through the interactive interface, the method further includes: Obtaining the availability, connection response time and authentication failure rate of the login authentication server to which the lightweight directory access protocol login component is bound; If the availability, connection response time and authentication failure rate of the login authentication server indicate that the login authentication server is abnormal, unbinding the login authentication server from the lightweight directory access protocol login component; A backup authentication server is obtained, and the backup authentication server is used as a new login authentication server to bind with the lightweight directory access protocol login component.

8. A database access device, characterized in that: The device comprises: An interactive module, used for displaying a lightweight directory access protocol login component embedded in a database management tool through an interactive interface; A verification module, configured to respond to target login authentication information input by a user through the lightweight directory access protocol login component and verify the target login authentication information through a login authentication server; The access module is used to access the database management tool if the verification of the target login authentication information is passed, and obtain the database user information corresponding to the target login authentication information, and access the database according to the database user information.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.