MariaDB and PhpMyAdmin: Cannot login

  • Hello,


    I installed a linuxserver/mariadb and a phpmyadmin/phpmyadmin docker in OMV and ran both with the following settings:


    MariaDB: https://pastebin.com/hCG5kiPC
    PhpMyAdmin: https://pastebin.com/3wFra1XP


    I masked the MYSQL_ROOT_PASSWORD and the PUID (I set it to the one of my OMV admin user) and the PGID (also admin).



    When I call: 192.168.0.10:82 in my browser and enter root and the password ********* I get the following message:
    mysqli::real_connect(): (HY000/1045): Access denied for user 'admin'@'172.17.0.1' (using password: YES)


    MariaDB seems to being started as expected. The following last lines of the log file look good to me:
    [services.d] starting services
    [services.d] done.
    191228 11:44:18 mysqld_safe Logging to syslog.
    191228 11:44:18 mysqld_safe Starting mysqld daemon with databases from /config/databases


    Can you give any hint, what i may have done wrong or how I can find further information?


    Thanks and kind regards,


    Felix

  • Hi Felix,


    It's probable that you are accessing the DB from two different hosts, or IP's, and the permissions aren't set up. Also, I think you might be using the wrong creds.


    For example, default permissions for a local, self contained setup (mariadb and phpmyadmin in the same container) would be something like, 'root'@'localhost' - mariadb/phpmyadmin. Where 'localhost' is the same IP as the calling host. If you're running phpmyadmin from that machine, then it's ok. In this instance, it is not, its two containers.


    If you're accessing it from two different containers, then you have to work out which IP they're calling from (network mode) . As well that you mention 'admin', which tells me you might be logging in with a different username than what is setup.


    What I would expect, is that if you run a container with mariadb, then the username/pass you should be using is something like 'root'@'localhost' if you have direct access to that container. If you run an external container as something different, then you might need to set up credentials like 'root'@'%' (which allows all hosts), or 'root'@'172.17.0.1' (which is likely your bridged network, or check your network mode).


    More than likely, its around network selection, and users that are setup on mariadb.


    [mariadb/phpmyadmin] = OK (not your case)


    [mariadb] / [phpmyadmin] = set up admin creds on [mariabd], use correct creds on phpmyadmin (your case)


    HTH


    wzball

  • Hello wzball,


    thanks a lot for your response. I installed both, phpmyadmin and mariadb following youtube tutorials, but they seem to be "deprecated" in that point, because after running the docker container, they login as root into phpmyadmin (which are on separate container as in my case).


    From running virtualboxes I know that I can explicitely grant remote root login, but it should be disabled.


    I now saw, on which ip (172.17.0.2) my mariadb server is running and tried to connect to it, via ssh, e.g. but no chance. Port 22 does not seem to being active. Do I have any chance to set this privileges and/or add a new user? I already adapted my /sharedfolders/AppData/MariaDB/custom.cnf - the databases and its config is located on my openmediafault file system and not in the docker container. There I already set
    skip-networking=0
    skip-bind-address
    But now I have to add a user / grant privileges via mysql console?!


    Thanks and kind regards,


    Felix

  • Hello,


    ok, I could solve my problem. The first was, I saved the wrong password in keypass / it was not taken into account by the maria db container, after modifying it. No clue. So I would have been able to connect from anywhere to MariaDB. Host for the user is %.


    Nevertheless, I first remembered this, after I found out, that I can list all docker containers using


    docker ps


    and then connect to the bash/shell of the container by


    docker exec -it <CONTAINER_NAME> /bin/bash


    From the container's bash I was able to log in via mysql -u root -p, after I took the right password from the container details. Now I'll ristrict the root access to localhost and create a new user for the database I want to use. Sorry for being mentally soooo blocked. :/8|:rolleyes:

  • One last thing: When I modify my mariadb docker settings and change the password to e.g. 1234$56, everything behind and including the $ seems to be cut-off.


    When I then, e.g. use 123-456 instead, I see that password in the details, but I cannot login. In the meanwhile, I created another user via sql.


    When I now
    SELECT user, password FROM mysql.user;the password for root looks e.g. *FD839DKD9kdidij3bdjdai3023kdaidahj4 (I just typed around on the keyboard, this is no real password encryption).Then I insteadSET PASSWORD FOR 'root'@'%' = PASSWORD('123-456');The encrypted password looks like *DA838JJDNAjjdah98329928292 and completely different to the one created by the docker container on start.Do you have any clue, how I can solve this?

  • Hi Felix,


    Progress is good.


    To set the mariadb root password, check the hub docker entry for linuxserver/mariadb.


    Took a the section, 'Parameters'. It says, to set the root password, you set the environment variable MYSQL_ROOT_PASSWORD. This will set it on boot of the container.


    I'm unsure, but just out of curiosity, how does this container persist data? I can't see how that works.


    Anyway, that environment variable just needs to get put in the container's Environment section. On the container, edit it, scroll down to Environment. In the bottom two editable text boxes, specify MYSQL_ROOT_PASSWORD, then enter the desired password in the box on the right. Make sure you hit the '+' to create the entry and make it stick.


    wzball

  • I'm unsure, but just out of curiosity, how does this container persist data? I can't see how that works.

    The persistent data is saved in the bind mount or docker volume which you set: -v path_to_data:/config


    Took a the section, 'Parameters'. It says, to set the root password, you set the environment variable MYSQL_ROOT_PASSWORD. This will set it on boot of the container.

    This sets the root password when you first create the container. Changing the parameter afterwards will not alter the root password.
    Changing the root password afterwards is a little more complex but can be done.

  • Hello wzball and Morlan,


    thanks a lot for your responses.

    That's how I set the password when setting-up and later when modifying the root password.

    ...


    This sets the root password when you first create the container. Changing the parameter afterwards will not alter the root password.Changing the root password afterwards is a little more complex but can be done.

    Ah, I see. As I don't have too many data now in the MariaDB, I would dump the data and recreate the container. I don't know the initial password anymore. Then I have a clean state.


    Thanks a lot, a happy new year and kind regards,


    Felix

  • Good Morning,


    short remark: I stopped and deleted the container and the re-ran the image and re-configured it with the root password. Databases and tables were still there (I located them into sharedfolders subfolder).


    Now everything works pretty fine. Thanks a lot, once again!


    Happy new year everyone!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!