Bug #118499 | .mylogin.cnf covered the command line | ||
---|---|---|---|
Submitted: | 23 Jun 9:20 | Modified: | 26 Jun 1:47 |
Reporter: | licheng guo | Email Updates: | |
Status: | Analyzing | Impact on me: | |
Category: | MySQL Server: Command-line Clients | Severity: | S2 (Serious) |
Version: | mysql-8.0.32 | OS: | Linux (centos7.9) |
Assigned to: | MySQL Verification Team | CPU Architecture: | Any |
Tags: | .mylogin.cnf |
[23 Jun 9:20]
licheng guo
[23 Jun 9:29]
licheng guo
How I discovered this problem is that I have a machine that someone else has used. He previously used mysql_config_editor --login-path=mysql to configure it. Later, I reinitialized a mysql instance and found that I could not log in to the mysql instance using socket after mysqld --initialize.
[26 Jun 1:47]
licheng guo
step1: sql> create user admin@'%' identified with mysql_native_password by 's25twgmpkK5LDS4EyXuP5HevypILrFlG'; grant all privileges on *.* to admin@'%' with grant option; sql> create user root@'%' identified with mysql_native_password by 'EmI8ddUp8RPFd0mK8ZUEMl3c6HJrOm9N'; grant all privileges on *.* to root@'%' with grant option; sql> alter user root@localhost identified with mysql_native_password by 'dudVPkt1u73kOj3uoUjPxAAB0t2JxZtg'; step2: shell> mysql -uroot -pdudVPkt1u73kOj3uoUjPxAAB0t2JxZtg -S /glc/mysql/tmp/mysql.sock -e "select version();" shell> mysql -uadmin -ps25twgmpkK5LDS4EyXuP5HevypILrFlG -h127.0.0.1 -P8032 -e "select version();" shell> mysql -uadmin -ps25twgmpkK5LDS4EyXuP5HevypILrFlG -h172.17.139.106 -P8032 -e "select version();" step3: # input the password:s25twgmpkK5LDS4EyXuP5HevypILrFlG shell> mysql_config_editor set --login-path=mysql --user=admin --host=172.17.139.106 --port=8032 --password shell> mysql --login-path=mysql -e "select version();" shell> mysql -uroot -pdudVPkt1u73kOj3uoUjPxAAB0t2JxZtg -S /glc/mysql/tmp/mysql.sock mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user 'root'@'172.17.139.106' (using password: YES)