webdb user cancnot login to db

Discussion in 'Installation/Configuration' started by muekno, Feb 22, 2023.

  1. muekno

    muekno Active Member HowtoForge Supporter

    ISPConfig set up with auto-installer
    I created a db user for a website and a db
    login to website ssh [email protected] (via key)
    mysql -u dbuser -pdbuserpassword dbname

    and get ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)

    dbexists verifyed with mysql -u root login
    otherwise my nextcloud installation works fine

    Regards
    Rainer
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Is it a jailed SSH user? That is, set to use jailkit?
     
  3. muekno

    muekno Active Member HowtoForge Supporter

    Sure it is, thats standard for me since years
     
  4. muekno

    muekno Active Member HowtoForge Supporter

    in all the mysql and maridb .cnf files port 3306 commented out and socket is enabled. I do not wont to break something again, so I would not change and if I do not know where thats in lot of cnf file in the /etc/etc/mysql structure
     
  5. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    when trying to connect, is the user trying to connect to localhost (name) or 127.0.0.1 (ip)
    it may just be that the unix socket is not included in the jailkit, (which is why root can still connect ok), you may just need to use the ip to connect to the tcp port instead.
     
  6. muekno

    muekno Active Member HowtoForge Supporter

    I tried:
    mysql -udb_user ...
    msql -u 'shelluser'@'127.0.0.1' .... recomotation found on the net
    msql -h127.0.0.1 -db_user ... got Access denied for user 'db_user'@'localhost' (using password: YES)

    My nextcloud installation runs fine, has only a database but no shell user, so no chroot.
    Again I used the auto-install to set up ISPConfig

    Reagards

    Rainer
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    To connect to a MySQL database from within a jail, you must connect to the localhost IP address, as the socket can not be reached as it's outside of the jail. But as you have used jails for years, you should be aware that you can not reach files and sockets that are not within a jail (which is basically the purpose of using a jail).

    mysql -h 127.0.0.1 -u username -pSomePassword databasename
     
  8. muekno

    muekno Active Member HowtoForge Supporter

    sorry I mostly worked as root and not as the shell user.
    I needed the database for my typo3 installation once it is installed, as root, I never needed the shell user again
    But thank you
    Rainer
     
  9. muekno

    muekno Active Member HowtoForge Supporter

    As I wrote above i tried this and sorry it still does not work:
    <code>
    zexxeb@mxxe:~$ mysql -h 127.0.0.1 -u c1xxxx -p$xxxxxxx! c1xxxxsde
    ERROR 1045 (28000): Access denied for user 'c1txxxx'@'localhost' (using password: YES)
    zexxeb@mxxe:~$
    </code>
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Then you are using either wrong username or password, or your password contains chars that get interpreted by bash, which means you must it either put into single quotes or use:

    mysql -h 127.0.0.1 -u c1xxxx -p c1xxxxsde

    which will make mysql command to ask you for the password interactively on the shell. You can also test this username and password using pghpmyadmin.
     
    muekno likes this.
  11. muekno

    muekno Active Member HowtoForge Supporter

    Thank you when entering the password interactively ist works.
    Thank you
     

Share This Page