mysql oddness? what a week I've had!

Discussion in 'ISPConfig 3 Priority Support' started by craig baker, Sep 1, 2020.

  1. craig baker

    craig baker Member HowtoForge Supporter

    I just sidestepped a rather large catastrophe - I had someone guess a password and upload a php file into the home directory of a wordpress site. I suspected they might have dumped the wp-config and got the db username/pw so I thought I would change the pw.
    big mistake!
    before I could log in with my user via mysql -u myuser -p and my password.
    after changing the password in ispconfig db users, suddenly mysql -u myuser -p did not recognize the myuser!
    I added a myuser1 in ispconfig, and in the mysql.user table it is NOT listed! 'myuser' is there but not 'myuser1'!
    now the root password in /...ispconfigpath/ .conf file is there and is correct. mysql -u root -p rootpassword works fine!
    but for some reason ispconfig does not seem to be affecting the mysql.user table at all. surely it should?
    not only did the new password not work (all wordpress sites using that database user gave databaseconnection error)., but I could not
    put in old password, or do anything!
    also addition oddness I used phpmyadmin to manually alter the mysql.user table (which I've done before for a forgotten password) - and I see the hash
    for root user (zzzzzzz) and I know what root user pw is and I put that pw in 'myuser' password, pick MD5 and save it.
    but in the table the created hash looks nothing like the hash that is shown for root!
    and copying the hash in root to myuser and saving (which then shows passwords the same in the mysql user,host,password dump - but
    the root password which should work now for myuser - is not recognized!
    I had to find a different database user, and put ITS password into the affected websites and change the dbuser in each database to the new user
    to get the sites back up!
    what on earth could be going on?? VERY odd. what a week from hell this has been!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    MySQL does not use md5 for passwords, you have to choose 'password' on the function field in phpmyadmin instead if you want to encode a password in the way MySQL does it.
     
  3. craig baker

    craig baker Member HowtoForge Supporter

    thats helpful thanks - MD5 is what the wordpress user tables used, I stupidly assumed mysql used it as well.
    BUT -- two points.
    putting my password in with the PASSWORD encryption now produces a hash that matches my root user hash - BUT I STILL CANNOT LOG IN to mysql!
    I get
    ERROR 1045 (28000): Access denied for user 'c0cdb'@'localhost' (using password: YES)
    but if I login with root - all good. and my 'old' user that I found in an older wp-config on another site, THAT login works fine with mysql right now!
    but not the one that I just this second changed to 'myrootpasswordwhateverit is' (not really) and picked PASSWORD encryption gives above error.
    ALSO - and more importantly - I added a new user c0cdb1 in ISPCONFIG3 and it does NOT show up in the mysql.user table?
    isnt that where you put database user accounts???
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    check that the MySQL root password is correct in the file /usr/local/ispconfig/server/lib/mysql_clientdb.conf
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    You must run the MySQL command:

    flush privileges;

    to apply manual changes in MySQL user table. Or alternatively, restart MySQL.
     
  6. craig baker

    craig baker Member HowtoForge Supporter

    yes password is clearly correct in /usr/local/ispconfig/server/lib/mysql_clientdb.conf. and I did restart mysql!
     
  7. craig baker

    craig baker Member HowtoForge Supporter

    and am I correct that ispconfig puts its database users in mysql.user table? but the one I added in ispconfig3 is not there.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes

    Did you add a database for that user? A MySQL user gets added at the time you create a database for it.
     
  9. craig baker

    craig baker Member HowtoForge Supporter

    Ah that explains that at least :) thanks till
     

Share This Page