Database account migration method, storage medium, and electronic device

By automating database account migration, the problems of long migration times and high costs associated with manual migration are solved, achieving an efficient and secure account migration process suitable for MySQL databases.

CN114840490BActive Publication Date: 2025-11-04QINGDAO HAIER TECH +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210291401.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-23
Publication Date
2025-11-04
Estimated Expiration
2042-03-23

AI Technical Summary

Technical Problem

The current MySQL database account migration relies on manual work, which is time-consuming and costly, making it unsuitable for large-scale account migrations. Furthermore, account passwords are easily leaked during the migration process.

Method used

By obtaining the address information and management password of the source and target databases, the system automatically queries the account information in the source database, generates migration instructions, and creates and authorizes accounts in the target database. The migration is carried out using encrypted passwords to avoid plaintext transmission.

Benefits of technology

It enables batch account migration without human intervention, saving time and costs, improving migration efficiency, and protecting account passwords in encrypted form to prevent leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114840490B_ABST
    Figure CN114840490B_ABST
Patent Text Reader

Abstract

The application discloses a database account migration method, a storage medium and an electronic device, relates to the technical field of smart home / smart home, and the database account migration method comprises the following steps: acquiring address information and a management password of a source database, and address information and a management password of a target database; based on the address information and the management password of the source database, querying original account information of each account in the source database in the source database; based on the original account information of each account and a syntax rule of the target database, generating an account migration instruction of each account; and based on the account migration instruction of each account and the address information and the management password of the target database, generating target account information of each account in the target database. The method and the device provided by the application automatically realize batch migration of each account from the source database to the target database, and labor cost and migration time are saved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of smart home, in particular to a database account migration method, a storage medium and an electronic device. BACKGROUND

[0002] MySQL database is one of the most popular and most used open source databases, and daily data migration is common, especially account and permission migration. Since the account and permission cannot be backed up separately during database backup, otherwise it will affect the use of the target database; the password of each account cannot be encrypted during the statistical process, and the process is prone to password leakage.

[0003] The existing migration of MySQL database account and permission information is generally that the operation and maintenance personnel query all accounts and their permissions in the database, and the password corresponding to the account can be directly obtained from the account table, and the password of the account without the account table is inquired from the application responsible person through internal work process or email, but the password obtained by this method is in plaintext, which is easy to cause password leakage. The database account password is very important, so the database account migration work needs to be carried out under strict security protection. The existing database account migration method relies on manual completion, and the account migration time is long and the cost is high, which cannot meet the needs of large-scale account migration. SUMMARY

[0004] The present application provides a database account migration method, a storage medium and an electronic device, which are used to solve the technical problem that the existing database account migration relies on manual completion, the account migration time is long and the cost is high, and it cannot meet the needs of large-scale account migration.

[0005] The present application provides a database account migration method, which comprises:

[0006] Obtaining the address information and management password of the source database, and the address information and management password of the target database;

[0007] Based on the address information and management password of the source database, the original account information of each account in the source database is obtained by querying in the source database; the original account information includes username, permission password ciphertext and user permission;

[0008] Based on the original account information of each account and the syntax rules of the target database, an account migration instruction of each account is generated; the account migration instruction includes an account creation command and an account authorization command;

[0009] Based on the account migration instruction of each account, and the address information and the management password of the target database, target account information of each account is generated in the target database.

[0010] According to the database account migration method provided in the application, the account migration instruction of each account is generated based on the original account information of each account, and the syntax rule of the target database, which comprises:

[0011] The account creation command of each account is generated based on the username and the permission password ciphertext in the original account information of each account, and the account creation statement in the syntax rule of the target database.

[0012] The account authorization command of each account is generated based on the user permission in the original account information of each account, and the account authorization statement in the syntax rule of the target database.

[0013] The account migration instruction of each account is generated based on the account creation command and the account authorization command of each account.

[0014] According to the database account migration method provided in the application, the target account information of each account is generated in the target database based on the account migration instruction of each account, and the address information and the management password of the target database, which comprises:

[0015] The username and the permission password ciphertext in the target account information of each account are generated by creating each account in the target database based on the account creation command in the account migration instruction of each account, and the address information and the management password of the target database.

[0016] The user permission in the target account information of each account is generated by granting the user operation permission to each account in the target database based on the account authorization command in the account migration instruction of each account, and the address information and the management password of the target database.

[0017] According to the database account migration method provided in the application, after the target account information of each account is generated in the target database based on the account migration instruction of each account, and the address information and the management password of the target database, the method further comprises:

[0018] The target account information of each account is compared with the original account information, if the username in the target account information of any account is the same as the username in the original account information, the permission password ciphertext in the target account information is the same as the permission password ciphertext in the original account information, and the user permission in the target account information is the same as the user permission in the original account information, then it is determined that the account migration result of the any account is successful.

[0019] Based on the account migration result of each account, the account migration result of the source database is determined.

[0020] According to the database account migration method provided in the application, the address information and the management password of the source database and the address information and the management password of the target database are obtained, which comprises:

[0021] Taking the source database or the target database as a current database, address input prompt information of the current database is sent to a user;

[0022] The candidate address information input by the user in response to the address input prompt information is received;

[0023] The candidate address information is verified in format based on a preset address format, if the verification is passed, the candidate address information is taken as the address information of the current database, and management password input prompt information is sent to the user;

[0024] The candidate management password input by the user in response to the management password input prompt information is received;

[0025] Each character in the candidate management password is displayed in mask based on a preset character, and password input confirmation information input by the user in response to the mask display result of the candidate management password is received;

[0026] Based on the password input confirmation information, the candidate management password is taken as the management password of the current database.

[0027] According to the database account migration method provided in the application, the password encryption algorithm adopted by the source database and the target database is the same.

[0028] According to the database account migration method provided in the application, the source database and the target database are MySQL databases.

[0029] The application provides a database account migration device, which comprises:

[0030] An acquisition unit is configured to acquire address information and a management password of a source database, and address information and a management password of a target database;

[0031] A query unit is configured to query original account information of each account in the source database in the source database based on the address information and the management password of the source database, wherein the original account information comprises a user name, a permission password ciphertext and user permissions;

[0032] The generating unit is configured to generate account migration instructions of each account based on the original account information of each account and the syntax rule of the target database; the account migration instructions include account creation commands and account authorization commands.

[0033] The migrating unit is configured to generate target account information of each account in the target database based on the account migration instructions of each account and the address information and the management password of the target database.

[0034] The application provides a computer readable storage medium, which comprises a stored program, wherein the program performs the database account migration method when running.

[0035] The application provides an electronic device, which comprises a memory and a processor, the memory stores a computer program, and the processor is configured to perform the database account migration method through the computer program.

[0036] The database account migration method provided by the application can obtain the original account information of each account in the source database through the address information and the management password of the source database; the account migration instructions of each account can be generated based on the original account information of each account and the syntax rule of the target database; and the target account information of each account in the target database can be generated based on the account migration instructions of each account and the address information and the management password of the target database, so that each account can be automatically migrated from the source database to the target database in batches without human intervention, the labor cost and the migration time are saved, the database information migration efficiency is improved, and the security risk of password leakage is avoided by migrating the permission password in the form of ciphertext during the account migration process. BRIEF DESCRIPTION OF DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0038] Figure 1 FIG. 1 is a flowchart of the database account migration method provided by the application;

[0039] Figure 2 FIG. 2 is an execution flowchart of the account migration program provided by the application;

[0040] Figure 3 FIG. 3 is a structural diagram of the database account migration device provided by the application;

[0041] Figure 4 Fig. 1 is a schematic diagram of a hardware environment of a database account migration method according to the present application;

[0042] Figure 5 Fig. 2 is a schematic diagram of the structure of an electronic device provided by the present application.

[0043] Reference signs:

[0044] 401: terminal device; 402: server. DETAILED DESCRIPTION

[0045] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.

[0046] It should be noted that the terms "first", "second", and the like in the present application are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0047] Figure 1 Fig. 3 is a schematic diagram of the flow of a database account migration method provided by the present application, as shown in Figure 1 The method comprises steps 110, 120, 130 and 140.

[0048] Step 110, obtaining the address information and management password of the source database, and the address information and management password of the target database.

[0049] Specifically, the database account migration method provided by the present application is used to transfer user accounts in one database to another database, so that users can directly log in and use in the new database without the need for re-registration and authorization. The source database is the database from which the user account is migrated, and the target database is the database into which the user account is migrated.

[0050] The address information is a server address of the database. The address information can include an Internet Protocol (IP) address and a port of the server of the database. The server running the database can be determined by the IP address, and an application or a process running in the server can be determined by the port.

[0051] The management password is a management permission password of the database. For example, a superuser permission of the database can be obtained by a root password of the database, and read and write operations on data information in the database can be performed.

[0052] In step 120, based on the address information and the management password of the source database, original account information of each account in the source database is queried and obtained. The original account information includes a username, a permission password ciphertext, and user permissions.

[0053] Specifically, the username is an account name of the user in the database, the permission password is a proof character when the user logs in or uses an operation command in the database, and the user permissions are a range and a degree of operations that can be performed by the user in the database. The above information can all be original account information of the account. At this time, the original account information can also include an operation history record of the user, and the like.

[0054] It should be noted that, for the permission password, generally, the database has encrypted the permission password, and the permission password is saved in the form of ciphertext. If the permission password ciphertext is decrypted into a permission password plaintext by an encryption algorithm in the database, the permission password in the plaintext form can have a risk of leakage in the process of account migration. Therefore, the permission password ciphertext is migrated as part of the original account information, so as to avoid the permission password from being leaked in the migration process.

[0055] According to the address information of the source database, communication with an application in the source database can be implemented. Through the management password of the source database, read and write permissions of data in the source database can be obtained, so that the original account information of each account in the source database is queried according to the read and write permissions.

[0056] For example, if the username, the permission password ciphertext, and the user permissions of each account in the source database are saved in a data table, the data table can be directly exported as the original account information of each account in the source database. For another example, if the username, the permission password ciphertext, and the user permissions of each account in the source database are saved in multiple data tables, a key field combination query can be used to obtain the original account information of each account. The original account information of each account in the source database can be obtained by combination query through the fields of “username”, “password”, and “permissions”.

[0057] In step 130, account migration instructions of each account are generated based on the original account information of each account and the syntax rule of the target database. The account migration instructions include an account creation command and an account authorization command.

[0058] Specifically, the account migration instructions include two parts of the account creation command and the account authorization command. The account creation command is used to create target accounts corresponding to each account in the source database in the target database, and the account authorization command is used to authorize the target accounts corresponding to each account in the source database in the target database.

[0059] According to the syntax rule of the target database and the original account information of each account, the account migration instructions of each account can be generated. For example, for any account, the original account information can be {username A, permission password ciphertext B, user permission C}. The target database is a MySQL database, and according to the syntax rule of the MySQL database, the account creation command of the account is "create user username A identified by permission password B", wherein the permission password B can be obtained by decrypting the permission password ciphertext B using an encryption algorithm in the MySQL database. The account authorization command of the account is "grant user permission C to username A".

[0060] In step 140, target account information of each account is generated in the target database based on the account migration instructions of each account and the address information and the management password of the target database.

[0061] Specifically, according to the address information of the target database, communication with the application program in the target database can be realized; through the management password of the target database, read and write permissions of data in the target database can be obtained, so that the account migration instructions of each account are executed in the target database according to the read and write permissions, and the target account information of each account is generated.

[0062] The target account information corresponds to the original account information one-to-one, including a username, a permission password ciphertext, and user permissions. After the target account information of each account is generated in the target database, a user can directly log in and use the target database according to the username and the permission password without re-registering and authorizing.

[0063] The database account migration method provided by the embodiments of the present application can be realized in a way of automatic execution by programming, for example, an account migration program can be programmed, the account migration program generates a script capable of running on a server according to the address information and the management password of the source database and the target database, and automatically migrates the accounts in the source database to the target database.

[0064] The database account migration method provided by the embodiments of the present application can query the original account information of each account in the source database through the address information and the management password of the source database, generate the account migration instruction of each account according to the original account information of each account and the syntax rule of the target database, and generate the target account information of each account in the target database according to the account migration instruction of each account and the address information and the management password of the target database, thereby automatically migrating each account from the source database to the target database without human intervention, saving the labor cost and the migration time, improving the database information migration efficiency, and migrating the permission password in the form of ciphertext during the account migration process, avoiding the security risk of password leakage.

[0065] Based on the above embodiments, step 130 comprises:

[0066] Based on the username and the permission password ciphertext in the original account information of each account and the account creation statement in the syntax rule of the target database, the account creation command of each account is generated.

[0067] Based on the user permission in the original account information of each account and the account authorization statement in the syntax rule of the target database, the account authorization command of each account is generated.

[0068] Based on the account creation command and the account authorization command of each account, the account migration instruction of each account is generated.

[0069] Specifically, the syntax rule of the target database refers to the rule followed by the data operation command in the target database. For example, for databases such as Oracle, MS SQL, Access and MySQL, SQL language (Structure Query Language) is supported.

[0070] The account migration instruction of each account can be generated in three steps:

[0071] First, the account creation command of each account is generated according to the username and the permission password ciphertext in the original account information of each account and the account creation statement in the syntax rule of the target database. For example, the account creation statement in the syntax rule of the target database is "create user username identified by permission password", the username in the original account information of any account is A, the permission password ciphertext is B', and the permission password B is obtained by decrypting the permission password ciphertext B' according to the encryption algorithm in the target database. Then the account creation command of the account is "create user A identified by B".

[0072] Secondly, according to the user permissions in the original account information of each account and the account authorization statements in the syntax rules of the target database, the account authorization commands of each account are generated. For example, the account creation statement in the syntax rules of the target database is "grant user permissions to username", the user permissions in the original account information of the user A are C, and the account authorization command of the account is "grant C to A".

[0073] Thirdly, the account creation commands and the account authorization commands of each account are combined to generate the account migration instructions of each account. For example, the account migration instructions of the account in the above example can be "create user A identified by B; grant C to A".

[0074] Based on any of the above embodiments, step 140 comprises:

[0075] Based on the account creation commands in the account migration instructions of each account and the address information and the management password of the target database, each account is created in the target database to generate the username and the permission password ciphertext in the target account information of each account;

[0076] Based on the account authorization commands in the account migration instructions of each account and the address information and the management password of the target database, the user operation permissions are granted to each account in the target database to generate the user permissions in the target account information of each account.

[0077] Specifically, according to the account migration instructions, each account is migrated into the target database. The data read-write permissions in the target database can be obtained according to the address information and the management password of the target database, and then the account creation commands and the account authorization commands in the account migration instructions of each account are executed in sequence to generate the username, the permission password ciphertext and the user permissions in the target account information of each account.

[0078] The account migration method can also be used to migrate the account in batches. For example, first, the data read-write permissions in the target database are obtained according to the address information and the management password of the target database, and then the account creation commands in the account migration instructions of each account are executed to create each account in sequence, and the username and the permission password ciphertext of each account in the target database can be obtained; secondly, the account authorization commands in the account migration instructions of each account are executed to grant the user operation permissions to each account in the target database to generate the user permissions of each account.

[0079] Based on any of the above embodiments, step 140 further comprises:

[0080] The target account information of each account is compared with the original account information, if the username in the target account information of any account is same as the username in the original account information, the permission password ciphertext in the target account information is same as the permission password ciphertext in the original account information, and the user permission in the target account information is same as the user permission in the original account information, it is determined that the account migration result of any account is successful;

[0081] Based on the account migration result of each account, the account migration result of the source database is determined.

[0082] Specifically, in order to facilitate the troubleshooting of abnormal situations in account migration and the checking of account migration results, after the account migration is completed, the target account information of each account in the target database can be exported, and the target account information of each account is compared with the original account information.

[0083] If the username in the target account information of any account is same as the username in the original account information, the permission password ciphertext in the target account information is same as the permission password ciphertext in the original account information, and the user permission in the target account information is same as the user permission in the original account information, it is determined that the account migration result of the account is successful; if at least one content in the target account information and the original account information is not same, it is determined that the account migration result of the account is failed.

[0084] If the account migration result of each account is successful, it is determined that the account migration result of the source database is successful, that is, all accounts in the source database are successfully imported into the target database. If there is an account with a failed account migration result, it is determined that the account migration result of the source database is failed or partially successful, and the account with a failed account migration result is separately executed for migration operation.

[0085] Based on any of the above embodiments, step 110 comprises:

[0086] Taking the source database or the target database as the current database, address input prompt information of the current database is sent to the user;

[0087] Receiving candidate address information input by the user in response to the address input prompt information;

[0088] The candidate address information is format verified based on a preset address format, if the verification is passed, the candidate address information is taken as the address information of the current database, and management password input prompt information is sent to the user;

[0089] Receiving candidate management password input by the user in response to the management password input prompt information;

[0090] mask display each character in the candidate management password based on a preset character, and receive password input confirmation information input by a user in response to the mask display result of the candidate management password;

[0091] based on the password input confirmation information, take the candidate management password as the management password of the current database.

[0092] Specifically, the source database and the target database can be taken as the current database in sequence, and the address information and the management password of the source database and the address information and the management password of the target database can be acquired in a parameter inquiry manner. Through the parameter inquiry manner, the address information can be verified, and the address information and the management password can be matched, so as to avoid input errors.

[0093] For example, the parameter inquiry of the source database can be executed through a script language, and the execution process is as follows:

[0094] The screen prints output address input prompt information, that is, "please input the address of the source database (for example, 10.10.10.10)", the user inputs a specific IP address (for example, 192.168.1.101) according to the address input prompt information, and the screen prints output the input IP address again, that is, "the address of the source database that you need to migrate is 192.168.1.101". In this process, the script language can also perform format verification on the IP address input by the user, verify whether the IP address input by the user meets the requirements of the address format specification, and avoid input errors. When the verification is passed, the IP address input by the user is taken as the address information of the source database.

[0095] The address information can also include a port. Accordingly, the parameter inquiry of the above address information can also include:

[0096] The screen prints output address input prompt information, that is, "please input the port of the source database (default 3306)", the user inputs a specific port number (for example, 13306) according to the address input prompt information, and the screen prints output the input port again, that is, "the port of the source database that you need to migrate is 13306", which is convenient for the user to view.

[0097] Thereafter, the script language sends the user a management password input prompt, i.e., a screen print output question "please enter the root password of the source database". The user inputs a specific root password according to the management password input prompt. Since the root password is relatively important, the screen will be replaced by a preset character during the input process to improve the security of the password and avoid account security incidents. The preset character can be a star character. The user determines whether the password input is complete according to the number of displayed preset characters, i.e., password input confirmation information. The script language automatically associates the user-input password with the source database according to the password input confirmation information.

[0098] The parameter inquiry process of the target database is similar to the above process, and will not be described again here.

[0099] According to any of the above embodiments, the password encryption algorithms used by the source database and the target database are the same.

[0100] Specifically, when the password encryption algorithms used by the source database and the target database are the same, the permission password ciphertext of each account in the source database can be directly decrypted and used after being migrated to the target database.

[0101] This makes it only necessary to verify whether the permission password ciphertext is the same as the permission password ciphertext in the original account information when verifying the target account information of each account in the target database, without the need to decrypt the ciphertext, thereby improving the security of the password during the account migration process.

[0102] According to any of the above embodiments, the source database and the target database are MySQL databases.

[0103] Specifically, when the source database and the target database are MySQL databases, an account migration program can be written to execute the above database account migration method on a Linux operating system.

[0104] Figure 2 is an execution flow diagram of the account migration program provided by the present application, as shown in Figure 2 The process executed by the account migration program includes:

[0105] Step 210, inquiry configuration

[0106] The address information and the management password of the source database and the address information and the management password of the target database input by the user are obtained by outputting parameter inquiry prompt information on the screen of the server;

[0107] Step 220, instruction generation

[0108] According to the address information and the management password of the source database, the original account information of each account in the source database is obtained by querying the source database, and according to the syntax rule of the target database, the account migration instruction of each account is generated;

[0109] Step 230, instruction execution

[0110] According to the account migration instruction, an executable script is generated, and the script language can adopt a Shell language. According to the address information and the management password of the target database, the script is automatically executed in the target database, and each account is imported into the target database;

[0111] Step 240, migration verification

[0112] The original account information of each account is compared with the target account information, and a verification result is checked and output.

[0113] The embodiment of the application can execute the steps of query configuration, instruction generation, instruction execution and migration verification by writing an account migration program. The account and the permission in the MySQL database do not need to be counted by using a manual method, and the password of each account does not need to be found. The migration instruction is automatically executed according to the steps generated in advance. Only the database account and the permission migration need to be completed, and the account password can be normally connected to the target database after the migration is completed. The time of the account password migration in the MySQL database is shortened, and the work efficiency of the database is improved.

[0114] In order to avoid that the MySQL database can be traced back after migration, the application can collect the logs generated in each link during migration, so as to check problems and operation audit.

[0115] The database account migration device provided by the application is described below. The database account migration device described below can be correspondingly referred to the database account migration method described above.

[0116] Based on any of the above embodiments, Figure 3 is a structural schematic diagram of the database account migration device provided by the application, as Figure 3 shown, the device comprises:

[0117] The acquisition unit 310 is configured to acquire the address information and the management password of the source database, and the address information and the management password of the target database.

[0118] The query unit 320 is configured to query the original account information of each account in the source database in the source database based on the address information and the management password of the source database. The original account information includes a user name, a permission password ciphertext and user permissions.

[0119] The generating unit 330 is configured to generate account migration instructions of each account based on the original account information of each account and the syntax rule of the target database; the account migration instructions include an account creation command and an account authorization command.

[0120] The migrating unit 340 is configured to generate target account information of each account in the target database based on the account migration instructions of each account and the address information and the management password of the target database.

[0121] The database account migration device provided by the embodiment of the present application can query the original account information of each account in the source database based on the address information and the management password of the source database, generate the account migration instructions of each account according to the original account information of each account and the syntax rule of the target database, and generate the target account information of each account in the target database according to the account migration instructions of each account and the address information and the management password of the target database, so that the batch migration of each account from the source database to the target database is automatically realized without human intervention, the labor cost and the migration time are saved, the database information migration efficiency is improved, and the security risk of password leakage is avoided by migrating the permission password in the form of ciphertext during the account migration process.

[0122] Based on any of the above embodiments, the generating unit is specifically configured to:

[0123] generate the account creation command of each account based on the username and the permission password ciphertext in the original account information of each account and the account creation statement in the syntax rule of the target database;

[0124] generate the account authorization command of each account based on the user permission in the original account information of each account and the account authorization statement in the syntax rule of the target database;

[0125] generate the account migration instructions of each account based on the account creation command and the account authorization command of each account.

[0126] Based on any of the above embodiments, the migrating unit is specifically configured to:

[0127] create each account in the target database based on the account creation command in the account migration instructions of each account and the address information and the management password of the target database, and generate the username and the permission password ciphertext in the target account information of each account;

[0128] grant the user operation permission to each account in the target database based on the account authorization command in the account migration instructions of each account and the address information and the management password of the target database, and generate the user permission in the target account information of each account.

[0129] Based on any of the above embodiments, the device further comprises a verification unit, and the verification unit is specifically configured to:

[0130] Compare the target account information of each account with the original account information, and if the username in the target account information of any account is the same as the username in the original account information, the permission password ciphertext in the target account information is the same as the permission password ciphertext in the original account information, and the user permission in the target account information is the same as the user permission in the original account information, it is determined that the account migration result of any account is successful;

[0131] Based on the account migration result of each account, the account migration result of the source database is determined.

[0132] Based on any of the above embodiments, the acquisition unit is specifically configured to:

[0133] Taking the source database or the target database as the current database, address input prompt information of the current database is sent to the user;

[0134] Candidate address information input by the user in response to the address input prompt information is received;

[0135] The candidate address information is format-verified based on a preset address format, and if the verification is passed, the candidate address information is taken as the address information of the current database, and management password input prompt information is sent to the user;

[0136] Candidate management password input by the user in response to the management password input prompt information is received;

[0137] Each character in the candidate management password is mask-displayed based on a preset character, and password input confirmation information input by the user in response to the mask-displayed result of the candidate management password is received;

[0138] Based on the password input confirmation information, the candidate management password is taken as the management password of the current database.

[0139] Based on any of the above embodiments, the password encryption algorithms adopted by the source database and the target database are the same.

[0140] Based on any of the above embodiments, the source database and the target database are MySQL databases.

[0141] Based on any of the above embodiments, the database account migration method is widely applied to smart home (Smart Home), smart home, smart home device ecology, intelligence house (Intelligence House) ecology, and whole-house intelligent digital control application scenarios.

[0142] Figure 4This is a schematic diagram of the hardware environment for the database account migration method according to this application, such as... Figure 4 As shown, the hardware environment consists of a terminal device 401 and a server 402. The server 402 is connected to the terminal device 401 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for the server 402. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for the server 402.

[0143] The aforementioned networks may include, but are not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network (WAN), metropolitan area network (MAN), local area network (LAN). The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. Terminal device 401 may not be limited to PCs, mobile phones, tablets, smart air conditioners, smart range hoods, smart refrigerators, smart ovens, smart stoves, smart washing machines, smart water heaters, smart washing equipment, smart dishwashers, smart projectors, smart TVs, smart clothes racks, smart curtains, smart audio-visual equipment, smart sockets, smart speakers, smart speakers, smart fresh air systems, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaners, smart window cleaning robots, smart mopping robots, smart air purifiers, smart steam ovens, smart microwave ovens, smart water heaters, smart air purifiers, smart water dispensers, smart door locks, etc.

[0144] Based on any of the above embodiments Figure 5 This is a schematic diagram of the electronic device provided in this application, such as... Figure 5 As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communications bus 540, wherein the processor 510, the communications interface 520, and the memory 530 communicate with each other via the communications bus 540. The processor 510 can call logical instructions in the memory 530 to execute the above-described method, which includes:

[0145] Obtain address information and management password of the source database, and obtain address information and management password of the target database; based on the address information and management password of the source database, query the original account information of each account in the source database; the original account information includes a username, a permission password ciphertext, and user permissions; based on the original account information of each account and the syntax rules of the target database, generate account migration instructions for each account; the account migration instructions include account creation commands and account authorization commands; based on the account migration instructions for each account and the address information and management password of the target database, generate target account information for each account in the target database.

[0146] In addition, the logic instructions in the memory 530 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0147] On the other hand, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program is executed by a processor, so that the computer can execute the above-mentioned methods, the specific embodiments of which are consistent with the above-mentioned method embodiments, and the same beneficial effects can be achieved, which will not be repeated here.

[0148] In yet another aspect, the present application also provides a computer readable storage medium having a computer program stored thereon, which is executed by a processor to implement the above-mentioned methods, the specific embodiments of which are consistent with the above-mentioned method embodiments, and the same beneficial effects can be achieved, which will not be repeated here.

[0149] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected to achieve the purposes of the embodiments according to actual needs. Those skilled in the art can understand and implement without creative labor.

[0150] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and necessary universal hardware platforms, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of software products, and the computer software products can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and include a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.

[0151] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A database account migration method, characterized by, The method comprises the following steps: obtaining address information and management password of a source database, and address information and management password of a target database; querying original account information of each account in the source database based on the address information and management password of the source database; the original account information comprises a username, a permission password ciphertext and user permissions; generating account migration instructions of each account based on the original account information of each account and syntax rules of the target database; the account migration instructions comprise account creation commands and account authorization commands; generating target account information of each account in the target database based on the account migration instructions of each account and the address information and management password of the target database; after generating the target account information of each account in the target database based on the account migration instructions of each account and the address information and management password of the target database, the method further comprises the following steps: comparing the target account information of each account with the original account information, and determining that the account migration result of any account is successful if the username in the target account information of the account is the same as the username in the original account information, the permission password ciphertext in the target account information is the same as the permission password ciphertext in the original account information, and the user permissions in the target account information are the same as the user permissions in the original account information; the source database and the target database adopt the same password encryption algorithm.

2. The database account migration method of claim 1, wherein, The method of generating the account migration instructions of each account based on the original account information of each account and the syntax rules of the target database comprises the following steps: generating the account creation commands of each account based on the username and the permission password ciphertext in the original account information of each account and an account creation statement in the syntax rules of the target database; generating the account authorization commands of each account based on the user permissions in the original account information of each account and an account authorization statement in the syntax rules of the target database; generating the account migration instructions of each account based on the account creation commands and the account authorization commands of each account.

3. The database account migration method of claim 1, wherein, The method of generating the target account information of each account in the target database based on the account migration instructions of each account and the address information and management password of the target database comprises the following steps: creating each account in the target database based on the account creation commands in the account migration instructions of each account and the address information and management password of the target database, and generating the username and the permission password ciphertext in the target account information of each account; granting user operation permissions to each account in the target database based on the account authorization commands in the account migration instructions of each account and the address information and management password of the target database, and generating the user permissions in the target account information of each account.

4. The database account migration method according to any one of claims 1 to 3, characterized in that, after generating the target account information of each account in the target database based on the account migration instructions of each account and the address information and management password of the target database, the method further comprises the following steps: Based on the account migration result of each account, determine the account migration result of the source database.

5. The database account migration method according to any one of claims 1 to 3, characterized in that, The address information and the management password of the source database and the address information and the management password of the target database are obtained, including: Taking the source database or the target database as a current database, address input prompt information of the current database is sent to a user; Receiving candidate address information input by the user in response to the address input prompt information; Based on a preset address format, the candidate address information is format-verified, and if the verification is passed, the candidate address information is taken as the address information of the current database, and management password input prompt information is sent to the user; Receiving candidate management password input by the user in response to the management password input prompt information; Based on a preset character, each character in the candidate management password is displayed in a mask mode, and password input confirmation information input by the user in response to the mask display result of the candidate management password is received; Based on the password input confirmation information, the candidate management password is taken as the management password of the current database.

6. The database account migration method according to any one of claims 1 to 3, characterized in that, The source database and the target database are MySQL databases.

7. A database account migration apparatus, characterized by comprising: Including: An obtaining unit is configured to obtain address information and a management password of a source database, and address information and a management password of a target database; The source database and the target database adopt the same password encryption algorithm; A querying unit is configured to query original account information of each account in the source database based on the address information and the management password of the source database in the source database; The original account information includes a username, a permission password ciphertext, and user permissions; A generating unit is configured to generate account migration instructions of each account based on the original account information of each account and a syntax rule of the target database; The account migration instructions include account creation commands and account authorization commands; A migrating unit is configured to generate target account information of each account in the target database based on the account migration instructions of each account and the address information and the management password of the target database; A verifying unit is configured to compare the target account information of each account with the original account information, and if the username in the target account information of any account is the same as the username in the original account information, the permission password ciphertext in the target account information is the same as the permission password ciphertext in the original account information, and the user permissions in the target account information are the same as the user permissions in the original account information, it is determined that the account migration result of the account is successful.

8. A computer readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program runs to execute the database account migration method in any one of claims 1 to 6. 9.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the database account migration method in any one of claims 1 to 6 through the computer program.

Citation Information

Patent Citations

  • Data migration method and device

    CN106874389A

  • Cloud host resource migration method and device, communication equipment and storage medium

    CN109995814A

  • User authentication migra tion method and device, equipment and storage medium

    CN113468509A

  • Method and device for migrating data, equipment and storage medium

    CN113792024A