skip to Main Content

I have been searching everywhere but I did not come any good working method to host phpmyadmin on dokku.

I tried to different options but couldn’t get to a working solution to host phpmyadmin and connect to mysql server on dokku.

2

Answers


  1. Chosen as BEST ANSWER

    I could finally host phpmyadmin on dokku. Here are the detail steps for the same.

    Step 1: Pull the Docker Image

    Start by pulling the official phpMyAdmin Docker image:

    docker pull phpmyadmin/phpmyadmin
    

    Step 2: Create a Dokku App

    Create a new Dokku app named phpmyadmin:

    dokku apps:create phpmyadmin
    

    Step 3: Deploy the Docker Image

    Deploy the Docker image to the Dokku app using the git:from-image command:

    dokku git:from-image phpmyadmin phpmyadmin/phpmyadmin
    

    Step 4: Create a MySQL Database

    Assuming you have the Dokku MySQL plugin installed, create a new MySQL database:

    dokku mysql:create demodb
    

    Step 5: Link the Database

    Link the newly created MySQL database to the phpmyadmin app:

    dokku mysql:link demodb phpmyadmin
    

    Step 6: Set Environment Variables

    Extract the database host name from the DSN provided by the Dokku MySQL plugin and set it as an environment variable for phpMyAdmin. You may need to set additional environment variables such as PMA_USER and PMA_PASSWORD for your phpMyAdmin user credentials[1].

    dokku config:set phpmyadmin PMA_HOST=YOUR_DATABASE_HOST PMA_USER=your_username PMA_PASSWORD=your_password
    

    Step 7: Configure Apache ServerName

    Build and deploy the custom Docker image:

    dokku git:from-image phpmyadmin my-custom-phpmyadmin
    

    Replace my-custom-phpmyadmin with the name of the directory containing your Dockerfile.

    Step 8: Set Port Configuration

    Set the port configuration for the phpmyadmin app to map HTTP port 80 to the container's port 80:

    dokku ports:set phpmyadmin http:80:80
    

    Step 9: Additional Configuration

    Set any additional environment variables required by phpMyAdmin:

    dokku config:set phpmyadmin VARIABLE_NAME=value
    

    Step 10: Verify Deployment

    Verify that the phpmyadmin app is running correctly by visiting the app's domain in your web browser.

    Additional Notes

    • Ensure you have the latest version of Dokku and all plugins are up to date.

    • Replace demodb with the actual name of your MySQL database.

    • Replace localhost in the Dockerfile with your server's FQDN or IP address if available.

    • The Dokku MySQL plugin can be installed with:

      sudo dokku plugin:install https://github.com/dokku/dokku-mysql.git mysql
      
    • Check your Dokku version with dokku --version and update if necessary.

    By following these steps, you should have a working installation of phpMyAdmin on your Dokku instance. Remember to secure your phpMyAdmin instance by using environment variables for credentials and consider using SSL/TLS for secure connections.


  2. I ended up just using MySQL Workbench connecting to my host via ssh. On the host, I exposed my mysql db to a port dokku mysql:expose <db_name> <port>.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search