In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The mysql_config_editor tool allows you to store audit identity information in an encrypted login path file. Mylogin.cnf. This file is stored in the% APPDATA%\ MySQL directory in Windows and in the current user's home directory on non-Windows platforms. This file can be read by the MySQL client program to obtain the audit identity information that connects to the MySQL server.
The unencrypted .mylogin.cnf login path file consists of option groups. Similar to other option files. Each option group in the .mylogin.cnf file is called the "login path" login path, and it is a group that only allows specific options: host,user,password,port and socket. You can think of a login path options group as a set of options to specify which user to use to connect to which MySQL server information. There is no encrypted login path information below
Example:
[client] user = mydefaultnamepassword = mydefaultpasshost = 127.0.0.1 [mypath] user = myothernamepassword = myotherpasshost = localhost
When calling a client program to connect to the MySQL server, the client uses .mylogin.cnf in combination with other option files. It has a higher priority than other option files, but lower than what is explicitly specified on the client command line.
To specify an alternative login path file name, set the MYSQL_TEST_LOGIN_FILE environment variable. This variable is identified by mysql_config_editor, by standard MySQL client (mysql,mysqladmin, etc.) tools and by mysql-test-run.pl testing tools.
The program uses the option group in the login path file in the following ways:
. MySQL _ config_editor uses the client option group by default when you do not explicitly specify the login path through the-- login-path=name option.
. Without using the-- login-path option, the client program reads the option group from the login path file as if it were read from other options files. For example:
Shell > mysql
By default, the mysql client program reads the [client] and [mysql] option groups from other option files, so it also reads this information from the login path file.
. Using the-- login-path option, the client program additionally retrieves the named login path from the login path file. It is still the same as reading option groups in other options files. For example:
Shell > mysql-- login-path=mypath
The mysql client program reads the [client] and [mysql] option group information from other option files and the [client] and [mysql] option group information from the login path file.
. Even when the-- no-defaults option is used, the client program reads the login path file. This allows you to specify the password in a secure way instead of on the command line.
Mysql_config_editor encrypts the .mylogin.cnf file so it cannot be read in clear text, and when the client program decrypts it, its contents are used only in memory. In this way, passwords can be stored in a file in non-plaintext format and do not need to provide an input password when later command line or environment variables need to be used. Mysql_config_editor provides a print command to display the contents of the login path file, but even in this case, the password value is hidden so that it does not appear in a way that other users can see
Preventing passwords from appearing in the .mylogin.cnf file in clear text through mysql_config_editor encryption provides a security measure by preventing inadvertent exposure of passwords. For example, if you display the information in the my.cnf options file on the screen in an unencrypted manner, any password it contains is visible to anyone. This is not the case with the .mylogin.cnf file. But the encryption used won't stop a determined attacker, and you shouldn't think it's unassailable. If a user can gain administrative privileges on your machine to access your files, he can easily decrypt the .mylogin.cnf file.
The login path file must be readable and writable to the current user and inaccessible to other users. Otherwise, mysql_config_editor ignores it and the client program does not use it.
Mysql_config_editor syntax:
Shell > mysql_config_editor [program options] [command [command options]]
If the login path file does not exist, mysql_config_editor creates it.
The mysql_config_editor command has the following parameter options:
The .program _ options consists of the general mysql_config_editor option.
.command indicates the action taken on the .mylogin.cnf login path file. For example, set will write a login path to the file, remove will delete a login path, and print will display the contents of the login path.
Command _ options indicates any additional options assigned to the command, such as the login path name and the value used by the login path.
The position of the command name in the program parameter set is important. For example, these command lines have the same parameters, but produce different results:
[mysql@localhost] $mysql_config_editor-- help setmysql_config_editor Ver 1.0 Distrib 5.7.26, for Linux on x86_64Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.MySQL Configuration Utility.Usage: mysql_config_editor [program options] [command [command options]]-#,-debug [= #] This is a non-debug version. Catch this and exit. -?-- help Display this help and exit. -v,-- verbose Write more information. -V -version Output version information and exit.Variables (- variable-name=value) and boolean options {FALSE | TRUE} Value (after reading options)-verbose FALSEWhere command can be any one of the following: set [command options] Sets user name/password/host name/socket/port for a given login path (section). Remove [command options] Remove a login path from the login file. Print [command options] Print all the options for a specified login path. Reset [command options] Deletes the contents of the login file. Help Display this usage/help information. [mysql@localhost] $mysql_config_editor set-- helpmysql_config_editor Ver 1.0 Distrib 5.7.26, for Linux on x86_64Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.MySQL Configuration Utility.Description: Write a login path to the login file.Usage: mysql_config_editor [program options] [set [command options]] -?-- help Display this help and exit. -h,-- host=name Host name to be entered into the login file. -G.-- login-path=name Name of the login path to use in the login file. (Default: client)-p,-- password Prompt for password to be entered into the login file. -u,-- user=name User name to be entered into the login file. -S,-- socket=name Socket path to be entered into login file. -P,-port=name Port number to be entered into login file. -w,-- warn Warn and ask for confirmation if set command attempts to overwrite an existing login path (enabled by default). (Defaults to on Use-skip-warn to disable.) Variables (--variable-name=value) and boolean options {FALSE | TRUE} Value (after reading options)-host (No default value) login-path clientuser (No default value) socket (No default value) port (No default value) warn TRUE
The first command line displays help for the generic mysql_config_editor and ignores the set command. The second command line displays specific help information for the set command.
Suppose you want to establish a client login path to define your default connection parameters and an additional remote login path to connect to the remote server. Want to record the following information:
. By default, the username and password to connect to the local server are root and xxzx7817600
. The username and password to connect to the remote server are root and 123456
To set the login path in the .mylogin.cnf file, use the following set command. Execute each command on a separate line and enter the relevant password as prompted:
[mysql@localhost] $mysql_config_editor set-- login-path=client-- host=192.168.1.250-- user=root-- passwordEnter password: [mysql@localhost ~] $mysql_config_editor set-- login-path=remote-- host=192.168.1.251-- user=root-- password-- port=33306Enter password: [mysql@localhost ~] $
Mysql_config_editor uses the client login path by default, so the-- login-path=client option can be ignored from the first command without any impact.
To query what mysql_config_editor wrote to the .mylogin.cnf file, execute the print command:
[mysql@localhost] $mysql_config_editor print-- all [client] user = rootpassword = * host = 192.168.1.250 [remote] user = rootpassword = * host = 192.168.1.251port = 33306
The print command displays each login path as a set of rows, with the option group header in square brackets indicating the login path name, followed by the option value of the login path. Password values appear as asterisks, not in clear text.
If you do not specify the-- all option to display all login paths or do not use-- login-path=name to display the specified login path when you execute the print command, if you save the client login path, then by default the print command will only display the client login path.
[mysql@localhost ~] $mysql_config_editor print [client] user = rootpassword = * host = 192.168.1.250
From the example above, you can see that a login path file can contain multiple login paths. In this way, mysql_config_editor can simply have multiple personalized login paths to connect to different MySQL servers or use different accounts to connect to specified servers. These login paths can be used by using the-- login-path option when calling the client program. For example, to connect to a remote server, execute the following command:
[mysql@localhost] $mysql-- login-path=remote Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 56674Server version: 5.7.26 MySQL Community Server (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql >
The above command mysql reads the [client] and [mysql] option groups from other option files and the [mysql] and [remote] option group information from the login path file.
To connect to the local server, execute the following command
[mysql@localhost] $mysql-- login-path=clientWelcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 6Server version: 5.7.26 Source distributionCopyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql >
Because mysql reads the client and mysql login paths in the login path file by default, in this case the-login-path option does not add other login paths. So the above command is equivalent to the following command:
[mysql@localhost] $mysqlWelcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 7Server version: 5.7.26 Source distributionCopyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql >
The option to read from the login path file takes precedence over the option read from other options files. The option to read from the login path group that appears later in the login path file takes precedence over the option to read from the earlier login path group in the file.
The order in which mysql_config_editor adds login paths to the login path files is the order in which they are created, so you should create more generic login paths before creating specific login paths. If you want to move a login path in the login path file, you can delete it and then recreate it. For example, a client login path is generic because all client programs will read it, while the mysqldump login path can only be read by mysqldump programs. The option specified later overrides the option specified earlier, so the login path is created in client,mysqldump order, and the mysqldump program allows the specific option of mysqldump to override the option of client.
You do not need to specify all possible option values (hostname, user name, password, port number, socket) when using mysql_config_editor 's set command to create a login path. Only the specified value is written to the login path. Any missing options that are needed when calling the client program to connect to the server can be specified in other options files or command lines. Any option value specified on the command line overrides the option value specified in the login path file or other options file. For example, if you specified the port number 33306 in the remote login path, and now assume that the remote server port becomes 3306, the command to connect to the server is as follows:
[mysql@localhost] $mysql-- login-path=remote-P3306Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 56674Server version: 5.7.26 MySQL Community Server (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql >
The port number specified on the command line overrides the port number specified in the login path
You can use the remove command to delete the login path or some options in the login path to delete the-- port option in the remote login path
[mysql@localhost ~] $mysql_config_editor print-- login-path= remote [remote] user = rootpassword = * host = 192.168.1.250port = 33306 [mysql@localhost ~] $mysql_config_editor remove-- login-path=remote-- port [mysql@localhost ~] $mysql_config_editor print-- login-path= remote [remote] user = rootpassword = * host = 192.168.1.250
Delete delete remote login path
[mysql@localhost] $mysql_config_editor remove-- login-path=remote [mysql@localhost ~] $mysql_config_editor print-- login-path=remote
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.