phpmyadmin access on Lightsail LAMP instance

0

I set up the instance no problem, I have phpmyadmin access thru an SSH tunnel -- no problem. I can only log in to phpmyadmin as root. (Perhaps by design?) So any DBs that I import can be seen by my web php code as long as I connect to mysql as root. But I don't want to do that -- I want to connect as "dbmasteruser" as the Lightsail console tells me to.

Connecting as dbmasteruser works OK too, but I have no visibility to DBs created as "root" in phpmyadmin. So I tried logging in to phpmyadmin as dbmasteruser (to create the DBs again), to no avail.

How can I achieve both phpmyadmin AND mysql both seeing all the databases I create? On my previous webhost, they configured it and it worked fine -- I never had to log into phpmyadmin as root.

Help!

Edited by: DaveMaul on Jul 13, 2019 3:10 PM

Wow, I guess these forums are mostly read, without many replies. I would hope Amazon staff would look in on these occasionally. Without help, I will kill my Lightsail instance and go with a different vendor who is more responsive. In the meantime, if anyone can help, I would appreciate it.

asked 5 years ago936 views
4 Answers
0

.

Edited by: DaveMaul on Jul 20, 2019 3:32 AM

answered 5 years ago
0

Hello,

Thank you for showing your interest in AWS Forums.

As you mentioned that you are able to use/login phpmyadmin (from http://<ip>/phpmyadmin) as a root via SSH tunneling which means everything is working fine as expected from AWS Infrastructure end.

Regarding your concern about the 'dbmasteruser' user i.e you are not able to view any DBs created/imported by the root user from 'dbmasteruser'.
--> In order to achieve your use-case, what I can suggest you is 'check for the mysql-user 'dbmasteruser' privileges as I believe that it doesn't have required admin-permission to view the DB/tables of 'root' user.

Please refer below links to learn more about Granting User level access in mysql.

Related links :
http://www.mysqltutorial.org/mysql-grant.aspx
https://chartio.com/resources/tutorials/how-to-grant-all-privileges-on-a-database-in-mysql/
https://dev.mysql.com/doc/refman/8.0/en/grant.html

I hope the above has provided some insight on the matter.

If there's something that you're concerned about please do post here and we'll do our best to find out/clarify for you.

answered 5 years ago
0

I paid for Developer support, and AWS was able to solve my problem. I am sharing it here to help others who may encounter similar issue.

A. Why phpmyadmin does not display database content in my lightsail database?
In your account, you have a lightsail LAMP instance "XXX", which is a complete application stack imaged by Bitnami, the stack contains these main components: Apache, php-fpm, mysql. Also, the stack is pre-installed with phpmyadmin, to allow users to manage the local database via GUI.
The point here is that phpmyadmin pre-installed in the LAMP stack is connecting to the local mysql database inside the same OS.
As for the lightsail database instance, it's actually a separate database instance outside the LAMP stack, and to access it via phpmyadmin from the LAMP instance, you will need to make a few configuration changes in phpmyadmin.

B. How to update phpmyadmin to be able to connect to my dedicate lightsail database?
You will need to update phpmyadmin configuration file config.inc.php in the LAMP stack, so it can point to lightsail database instead of localhost. The configuration file is located at /opt/bitnami/apps/phpmyadmin/htdocs/config.inc.php
Following is the steps that I took in my own lab environment to update the configuration file:

  1. SSH to the LAMP stack with user bitnami
  2. Find the configuration file and take a backup

sudo su

cd /opt/bitnami/apps/phpmyadmin/htdocs

cp config.inc.php config.inc.php.bkp

  1. Update the file with your favorite text editor.
    Following lines will need to be changed (I have updated the database endpoint and username to reflect the information in your account):
    From:
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['user'] = 'root';

To:
$cfg['Servers'][$i]['host'] = 'longHostNameEndingIn.ca-central-1.rds.amazonaws.com ';
$cfg['Servers'][$i]['user'] = 'dbmasteruser';

Edited by: DaveMaul on Jul 28, 2019 8:01 AM

answered 5 years ago
0

I joined AWS Developer support, after which I got a good answer.

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions