In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Brief introduction
Mysql_config_editor is a tool for storing mysql login information.
After the login information is set through mysql_config_editor, when you log in to the database with the mysql command, you can specify the name set in mysql_config_editor with only one parameter-- login-path=name, instead of entering information such as host,user,password.
For example:
Mysql-login-path=5637
The login information set through mysql_config_editor is stored in a configuration file named .mylogin.cnf. On Windows systems, the file is in the% APPDATA%\ MySQL directory, and on linux systems, the file is in the user's home directory
Format of .mylogin.cnf
In .mylogin.cnf, you can store login information for multiple databases, each of which is a group of login path options, each starting with a name enclosed in square brackets and then composed of one or more of the host,user,password,port,socket.
For example:
[client]
User = mydefaultname
Password = mydefaultpass
Host = 127.0.0.1
[mypath]
User = myothername
Password = myotherpass
Host = localhost
When connecting to the database through the mysql command, if the-- login-path option is not specified or-- login-path=name is not specified, the configuration of client in .mylogin.cnf will be read by default. (even if-- login-path=name is specified, the contents of the client will be read. And in .mylogin.cnf, the later content will overwrite the previous content, that is, if clinet is in name, then values such as user,host are set in both name and client, and the values in client will prevail. )
The settings in .mylogin.cnf take precedence over those in other configuration files, but are lower than the parameters entered on the command line.
Use mysql_config_editor to set login path and add login path
You can add a login path through the set command
For example: mysql_config_editor set-login-path=name-host=hostname-user=user_name
The set command has the following parameters:
-- help displays help-- login-path=name,-G name--host=host_name,-h host_name hostname-- password,-p password. Note that this place cannot use "=" to write the password directly-- port=port_num,-P port_num port number-- socket=file_names,-S file_name file name-- user=user_name,-u user_name user name-- warn,-w is enabled by default, prompting warning messages, if you want to ignore the warning. Use the-- skip-warn parameter
Example:
Delete login path
The specified options in login path or login path can be removed from the remove command. If you do not specify-- login-path, the relevant content in the clinet will be deleted.
Remove has the following parameters
-- host,-h hostname-- name of login-path=name,-G name login path. If not specified, default is clinet--password,-p password-port,-P port number-socket,-S socket file-user,-u user name-warn,-w is enabled, prompting warning message. If you want to ignore the warning, use the-- skip-warn parameter to clear the login path.
All configuration information can be cleared through the reset command
Mysql_config_editor reset
Show login path
The profile information that has been set can be displayed through the print command.
Mysql_config_editor print
The print command has the following parameters:
-- all displays information for all login-path-- login-path=name,-G name displays information for login path with specified name
If no parameter is specified, the information for the login path named client is displayed by default
If both-- all and-- login-path=name are specified, information for all login path is displayed.
The password is replaced by * in the information displayed by the print command
Example:
Since there is no login path named client, all print with no parameters will not display anything.
Use the example
There are two versions of data, 5637 and 5719, on the local server with different socket files and root passwords. The information is as follows:
Ps-ef | grep mysqld
To make it easy to connect, set login path through mysql_config_editor
Mysql_config_editor set-login-path=5637-socket=/tmp/mysql5637.sock-user=root-password
Mysql_config_editor set-login-path=5719-socket=/tmp/mysql5719.sock-user=root-password
Check whether the login path is set successfully
Mysql_config_editor print-all
Connect to the database through login path
Mysql-login-path=5719
Mysql-login-path=5637
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.