Menu

#103 MySQL password with '#' character does not connect

New_Module
closed
mysql (2)
5
2025-01-03
2021-01-17
No

Eric,

Just an FYI. One of our current MySQL servers has as the user password a "#" in it. When we go to the MySQL stats and I use the module acquisition dialog I can see that the 'mysqladmin' command is unable to connect to the mysql server - I assume because there is something wrong with the password. When I remove the "#" characters from the password then everything works OK again. Rather curious. The password was originally ##(redacted)## and it is now JUST (redacted).

Seems to have ONLY happened with the latest release. See the attached screenshot. I applied the latest webminststats last Monday around 11am and that's when it broke.

Rick.

1 Attachments

Related

Bugs: #103

Discussion

  • eric gerbier

    eric gerbier - 2021-01-18

    Hi,
    can you have 2 checks ?

    • first check the /root/.my.cnf file : it should contain the password (https://dev.mysql.com/doc/mysql-security-excerpt/5.6/en/password-security-user.html )
    • then , in a bash console, check if you can access the database without password with a command like (as root user) : mysqladmin -u root extended-status
     
  • eric gerbier

    eric gerbier - 2021-01-18
    • assigned_to: eric gerbier
     
  • Rick Pearson

    Rick Pearson - 2021-01-18

    Eric,

    MySQL is v5.5.59 (Server is Centos6). the file /root/.my.cnf has the new password (minus the "#" characters). When I issue the command "mysqladmin -u root extended-status" I get in.

    Now, when I reset the password back to having the "#" characters I see:

    [root@asahipb ~]# vi .my.cnf (with the "#" characters)
    [root@asahipb ~]# mysqladmin -u root extended-status
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'
    [root@asahipb ~]# vi .my.cnf (without the "#" characters)
    [root@asahipb ~]# mysqladmin -u root extended-status
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: YES)'
    [root@asahipb ~]#

    Based on this it appears that the issue is in the PARSING of the .my.cnf file by mysql and in that it treats the "#" as a comment character and then disregards the whole line (in effect ignoring the password).

    Thanks for the test regime - I should have thought of that first!

     
  • Rick Pearson

    Rick Pearson - 2021-01-18

    FYI: https://bugs.mysql.com/bug.php?id=74482

    PS: Thanks for a superb job on webminstats. Is installed on over 150 servers that we manage and works beautifully.

     
  • eric gerbier

    eric gerbier - 2021-01-22

    Can you check if adding quotes in .my.cnf like : password="hash#pwd"
    can solve the problem ?
    If yes, I will modify the code in mysql-lib.pl :
    diff --git a/modules/mysql/mysql-lib.pl b/modules/mysql/mysql-lib.pl
    index b5eb6e58..4c2c0b02 100755
    --- a/modules/mysql/mysql-lib.pl
    +++ b/modules/mysql/mysql-lib.pl
    @@ -715,7 +715,7 @@ sub write_cnf($$) {

        # write cnf file
        if ( open my $fh, '>', $cnf ) {
    
    • print {$fh} "[client]\npassword=$password\n";
    • print {$fh} "[client]\npassword=\"$password\"\n";
     
    • Anonymous

      Anonymous - 2021-01-25

      That works fine - thanks.

      debug Mon Jan 25 12:14:41 2021 main::init_module_run(/etc/webmin/sysstats/modules/mysql/../../sysstats-aquisition-lib.pl 509) : run mysql version 1.13
      debug Mon Jan 25 12:14:41 2021 main::get_admin_server_status(./mysql.pl 46) : use mysqladmin method : /usr/bin/mysqladmin
      debug Mon Jan 25 12:14:41 2021 main::get_admin_server_status(./mysql.pl 64) : cmd : /usr/bin/mysqladmin --user=root --port=3306 --host=localhost extended-status
      debug Mon Jan 25 12:14:41 2021 main::read_pipe_stream(/etc/webmin/sysstats/modules/mysql/../../sysstats-gen-lib.pl 615) : read_pipe : /usr/bin/mysqladmin --user=root --port=3306 --host=localhost extended-status
      debug Mon Jan 25 12:14:41 2021 main::my_close_pipe(/etc/webmin/sysstats/modules/mysql/../../sysstats-gen-lib.pl 574) : close pipe /usr/bin/mysqladmin --user=root --port=3306 --host=localhost extended-status
      debug Mon Jan 25 12:14:41 2021 main(./mysql.pl 194) : mysql Aborted_clients (1) : total=0
      debug Mon Jan 25 12:14:41 2021 main(./mysql.pl 194) : mysql Aborted_connects (2) : total=28
      debug Mon Jan 25 12:14:41 2021 main(./mysql.pl 194) : mysql Bytes_received (3) : total=711979896
      debug Mon Jan 25 12:14:41 2021 main(./mysql.pl 194) : mysql Bytes_sent (4) : total=10669162609
      debug Mon Jan 25 12:14:41 2021 main(./mysql.pl 194) : mysql Connections (5) : total=69030
      debug Mon Jan 25 12:14:41 2021 main(./mysql.pl 194) : mysql Uptime (6) : total=610400

      From: eric gerbier gerbier@users.sourceforge.net
      Sent: Saturday, 23 January 2021 2:09 AM
      To: [webminstats:bugs] 103@bugs.webminstats.p.re.sourceforge.net
      Subject: [webminstats:bugs] #103 MySQL password with '#' character does not connect

      Can you check if adding quotes in .my.cnf like : password="hash#pwd"
      can solve the problem ?
      If yes, I will modify the code in mysql-lib.pl :
      diff --git a/modules/mysql/mysql-lib.pl b/modules/mysql/mysql-lib.pl
      index b5eb6e58..4c2c0b02 100755
      --- a/modules/mysql/mysql-lib.pl
      +++ b/modules/mysql/mysql-lib.pl
      @@ -715,7 +715,7 @@ sub write_cnf($$) {

      # write cnf file
      
      if ( open my $fh, '>', $cnf ) {
      
      • print {$fh} "[client]\npassword=$password\n";
      • print {$fh} "[client]\npassword=\"$password\"\n";

      [bugs:#103]https://sourceforge.net/p/bibdesk/bugs/103/ MySQL password with '#' character does not connect

      Status: open
      Group: New_Module
      Labels: mysql
      Created: Sun Jan 17, 2021 11:55 PM UTC by Rick Pearson
      Last Updated: Mon Jan 18, 2021 11:04 PM UTC
      Owner: eric gerbier
      Attachments:

      Eric,

      Just an FYI. One of our current MySQL servers has as the user password a "#" in it. When we go to the MySQL stats and I use the module acquisition dialog I can see that the 'mysqladmin' command is unable to connect to the mysql server - I assume because there is something wrong with the password. When I remove the "#" characters from the password then everything works OK again. Rather curious. The password was originally ##(redacted)## and it is now JUST (redacted).

      Seems to have ONLY happened with the latest release. See the attached screenshot. I applied the latest webminststats last Monday around 11am and that's when it broke.

      Rick.


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/webminstats/bugs/103/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #103

  • eric gerbier

    eric gerbier - 2025-01-03
    • status: open --> closed
     
  • eric gerbier

    eric gerbier - 2025-01-03

    fixed in mysql module 1.14 /webminstats 2.21

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB