Can't Connect to DB

Discussion in 'ISPConfig 3 Priority Support' started by yupthatguy, Oct 5, 2021.

  1. yupthatguy

    yupthatguy Member

    I want to install some WP sites, but I can't start the installer because, WP is unable to connect to DB although username and pwd are correct.

    so I opened tester1.example.com/phpmyadmin and tested user/pwd.. and I also couldn't log in instead getting this error:
    mysqli_real_connect(): (HY000/1045): Access denied for user 'user'@'localhost' (using password: YES)

    I did some reading... and ran across this as a possible fix.

    Code:
    UPDATE user SET plugin='mysql_native_password' WHERE User ='root';
    So I logged into phpmyadmin as root.. selected the db and ran this the above code as a query...but no luck

    How can I fix this?
     
  2. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    If using chroot mode php-fpm, use 127.0.0.1 as the database host instead of localhost.
     
  3. yupthatguy

    yupthatguy Member

    I tried that and 127.0.0.1:3306, nothing works
     
  4. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    in mysql.user table, you see the site user created? and that database exists? If not, enable server debugging level to see what happens (eg. delete the database and add it again).
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    If this would have been an issue, then you could not even have installed ISPConfig on this system as no root logins using a password would have been possible from the beginning.

    Back to the original issue, run the command:

    ls /var/lib/mysql/

    does the output show a folder with the name of the database that you created?

    And does the file /usr/local/ispconfig/server/lib/mysql_clientdb.conf contains the correct MySQL root password?
     
  6. yupthatguy

    yupthatguy Member

    And Yes...

    I haven't had time to do the testing that @jesse-Norell has recommended...
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Did you enable chroot mode in php-fpm on the options tab of the site? If yes, try to disable it, wait until changes are written to disk and test again.
     
  8. yupthatguy

    yupthatguy Member

    Quick note: If I manually create the wp-config.php file... I can install no problem... but via the WP install gui.. the same information can not connect to the DB.
     
  9. yupthatguy

    yupthatguy Member

    Just saw post #7 will give it a try
     
  10. yupthatguy

    yupthatguy Member

    Just checked all of my sites, none of them have chroot mode in php-fpm enabled
     
  11. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Did you do that as root user?
    What are owners and permissions for the web directory? Is suexed enabled in website settings?
     
  12. yupthatguy

    yupthatguy Member

    Impossible. I had to ssh into the directory with a shell-user for the domain.
    Code:
    # stat /var/www/clients/client1/web9
      File: /var/www/clients/client1/web9
      Size: 4096          Blocks: 8          IO Block: 4096   directory
    Device: 801h/2049d    Inode: 666455      Links: 16
    Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2021-10-06 00:46:43.571122425 +0800
    Modify: 2021-07-05 14:55:01.541944749 +0800
    Change: 2021-10-06 14:16:01.915802960 +0800
     Birth: -
    
    Code:
    # ls -l /var/www/clients/client1/web9
    total 52
    lrwxrwxrwx 1 root root       7 Jul  4 12:40 bin -> usr/bin
    drwxr-xr-x 2 web9 client1 4096 Jul  4 10:22 cgi-bin
    drwxr-xr-x 2 root root    4096 Oct  6  2021 dev
    drwxr-xr-x 8 root root    4096 Jul  4 13:49 etc
    drwxr-xr-x 4 root root    4096 Jul  4 13:49 home
    lrwxrwxrwx 1 root root       7 Jul  4 12:40 lib -> usr/lib
    lrwxrwxrwx 1 root root       9 Jul  4 12:40 lib64 -> usr/lib64
    drwxr-xr-x 2 root root    4096 Oct  6 07:48 log
    drwxr-xr-x 3 root root    4096 Jul  4 12:48 opt
    drwx--x--- 2 web9 client1 4096 Jul  4 10:22 private
    drwxr-xr-x 2 root root    4096 Jul  4 10:22 ssl
    drwxrwx--- 2 web9 client1 4096 Jul  4 10:22 tmp
    drwxr-xr-x 8 root root    4096 Jul  4 12:45 usr
    drwxr-xr-x 4 root root    4096 Jul  4 13:49 var
    drwx--x--x 7 web9 client1 4096 Jul 24 10:42 web
    drwx--x--- 2 web9 client1 4096 Jul  4 10:22 webdav
    
    Yes, for all my sites.
     
  13. yupthatguy

    yupthatguy Member

    Ok... I just tried @Jesse Norell recommendation from post #4.... turned on debug... then deleted both db user and the actually db and re-created them. Went back to the gui to test.. same problem. Which parts of the logs do you need?
     
  14. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    With debugging enabled, run server.sh manually to run those changes (ie. you'll need to recreate them), and post the output from that.
     
  15. yupthatguy

    yupthatguy Member

    odd. I can't locate / run server.sh ...thoughts?
     
  16. yupthatguy

    yupthatguy Member

    Ok.. checked the manual...

    I commented out:
    Code:
    #* * * * * /usr/local/ispconfig/server/server.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    
    and ran:
    Code:
    /usr/local/ispconfig/server/server.sh
    Output:
    Code:
    # /usr/local/ispconfig/server/server.sh
    finished server.php.
    
     
  17. yupthatguy

    yupthatguy Member

    whoops... rushing.. forgot to re-create the db and user... one sec
     
  18. yupthatguy

    yupthatguy Member

    Ok specific steps... again.
    And I check the sysem-log multiple times during this...

    Nothing.. no errors, warnings, nothing :-/
     
  19. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  20. yupthatguy

    yupthatguy Member

    Thx... I read it.. but I have done all the steps the instructions contain.. at this point at least twice.:(
     

Share This Page