On your Hestia server run the following command (mysql may be replaced by postgresql):
v-add-database-host mysql new-server.com root password
To make sure the host has been added, run the following command:
v-list-database-hosts
http://ip/phpmyadmin/For security reasons, we have decided to disable this option. Please use https://host.domain.tld/phpmyadmin/ instead.
Replace myrootusername & myrootusername_password with preferred credentials:
mysql -uroot
CREATE USER 'myrootusername'@'localhost' IDENTIFIED BY 'myrootusername_password';
GRANT ALL PRIVILEGES ON *.* TO 'myrootusername'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
QUIT;
http://ip/phpmyadmin/nano /etc/apache2/conf.d/ip.conf
# Add the following code before both </VirtualHost> closing tags
IncludeOptional /etc/apache2/conf.d/*.inc
# Restart apache2
systemctl restart apache2
# You can also add the following in /etc/apache2.conf instead
IncludeOptional /etc/apache2/conf.d/*.inc
nano /etc/nginx/conf.d/ip.conf
# Replace the following
location /phpmyadmin/ {
alias /var/www/document_errors/;
return 404;
}
location /phppgadmin/ {
alias /var/www/document_errors/;
return 404;
}
# With the following
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
By default, connections to port 3306 are disabled in the firewall. Open
port 3306 in the firewall (documentation), then edit /etc/mysql/mariadb.conf.d/50-server.cnf:
nano /etc/mysql/mariadb.conf.d/50-server.cnf
# Set bind-address to one of the following
bind-address = 0.0.0.0
bind-address = "your.server.ip.address"
NOTE: PhpMyAdmin Single Sign On enabled only for individual databases. Primary "PhpMyAdmin" button for existing database credintials only.
Make sure the API is enabled and working properly. Hestia’s PhpMyAdmin Single Sign On function connects over the Hestia API.
Automated can sometimes cause issues. Login via SSH and open /var/log/{webserver}/domains/{hostname.domain.tld.error.log and look for one of the following error messages:
Unable to connect over API, please check API connection
Access denied: There is a security token mismatch
Link has expired
If needed you can simply host Mysql or Postgresql on a remote server.
To add a remote database:
v-add-database-host TYPE HOST DBUSER DBPASS [MAX_DB] [CHARSETS] [TPL] [PORT]
For example:
v-add-database-host mysql db.hestiacp.com root mypassword 500
If you want you can setup phpMyAdmin on the host server to allow to connect to the database. Create a copy of 01-localhost file in /etc/phpmyadmin/conf.d and change:
$cfg["Servers"][$i]["host"] = "localhost";
$cfg["Servers"][$i]["port"] = "3306";
$cfg["Servers"][$i]["pmadb"] = "phpmyadmin";
$cfg["Servers"][$i]["controluser"] = "pma";
$cfg["Servers"][$i]["controlpass"] = "random password";
$cfg["Servers"][$i]["bookmarktable"] = "pma__bookmark";
Please make sure to create aswell the phpmyadmin user and database.
See /usr/local/hestia/install/deb/phpmyadmin/pma.sh