timbo475
timbo475

Reputation: 1

Issues connecting phpmyadmin to multiple instances

I'm rebuilding a database server on CentOS7 using mariadb (distrib 5.5.56). The original database server is Ubuntu 12.04 using mysql (distrib 5.5.29). The original server has multiple instances (running on different ports) and users can use phpmyadmin to log into the different database instances by selecting the server in the phpmyadmin login page.

Before I import the database to the new server I'm trying to a similar setup working on the new server. I've tried to keep most paths the same (my.cnf is a little different due to using mysql on one server and mariadb on another but database locations are the same)

I believe I've got the multiple instances running OK ('mysqld_multi report' reports both instances are running OK and I can connect to both instances via 'msql' command when a port is specified).

I got phpmyadmin working for the default mariadb database (did this prior to setting-up the other instances in my.cnf) so I know phpmyadmin is working OK. I've modified the file /etc/phpMyAdmin/config.inc.php to enable connecting into multiple instances by essentially copying the file from the original server. I'm just unable to login to the actual instances I've configured. If the mariadb service is running then it will log me into the default mariadb database when specifying either instance rather than the actual instance I want. When I stop the mariadb service, although I can connect using 'mysql --port=xxxx.... command phpmyadmin simply gives me the error 'Cannot log in to the MySQL server'.

I just can't figure out when this is not working. I suspect it's something trivial in a config file somewhere but can't work out what it is. I've double-checked things like my.cnf and config.inc.php and can't see anything obviously wrong with them.

Any assistance would be appreciated!

Cheers,

Tim

Upvotes: 0

Views: 798

Answers (1)

timbo475
timbo475

Reputation: 1

I believe I have figured it out. It appears to be a combination of things. In config.inc.php I had specified the host = 'localhost', because that's how it was configured on the original Ubtuntu mysql server. Once I changed to '127.0.0.1' then phpmyadmin was able to connect BUT this wasn't the only issue. The other issue was that selinux also needed to allow certain things (see https://community.spiceworks.com/topic/693552-mariadb-phpmyadmin-selinux-woes - refer to Jesse1648 comments - also need to use -P to set permanently). With these 2 changes I am now able to connect to instances on different ports.

What I don't actually understand is that I had tried to copy the config from the original server as much as possible because it worked. Why it actually works when specifying 'localhost' in config.inc.php (rather than '127.0.0.1') is a bit mystifying (I know that mysql commands ignore ports if 'localhost' is used when specifying hostname). The important thing is that it works!

Upvotes: 0

Related Questions