Mysql remote server

Hello. My question is related to a remote MySQL server.
I’ve added a remote server to the dashboard. There are no questions here.

Could you tell me how to hide the localhost server when adding a new database and only show the remote one? Thank you.

Is there such a possibility or not?

If you don’t want the localhost connection, you could delete it (it might cause issues, so I wouldn’t recommend it.).

v.delete-database-hos mysql localhost

Before deleting it, backup the conf files mysql.conf and .mysql.localhost in /usr/local/hestia/conf/

Is it possible to simply hide localhost when creating a new database, and leave only the remote server?

To do so you must modify the php code to exclude those entries with HOST = localhost. Keep in mind that this change will be removed on every Hestia update.

You could edit /usr/local/hestia/web/add/db/index.php and replace this:

// List available database servers
exec(HESTIA_CMD . "v-list-database-hosts json", $output, $return_var);
$db_hosts_tmp1 = json_decode(implode("", $output), true);
$db_hosts_tmp2 = array_map(function ($host) {
        return $host["HOST"];
}, $db_hosts_tmp1);
$db_hosts = array_values(array_unique($db_hosts_tmp2));
unset($output);                 
unset($db_hosts_tmp1);  
unset($db_hosts_tmp2);

with this:

 // List available database servers
exec(HESTIA_CMD . "v-list-database-hosts json", $output, $return_var);
$db_hosts_tmp1 = json_decode(implode("", $output), true);      
// Filter to exclude those with HOST = localhost
$db_hosts_tmp1 = array_filter($db_hosts_tmp1, function ($host) {
    return $host["HOST"] !== "localhost";
});
$db_hosts_tmp2 = array_map(function ($host) {
        return $host["HOST"];
}, $db_hosts_tmp1);             
$db_hosts = array_values(array_unique($db_hosts_tmp2));
unset($output);         
unset($db_hosts_tmp1);          
unset($db_hosts_tmp2);
1 Like

v-delete-database-host localhost should probally work fin e

1 Like

root@hestiatest:~# v-delete-database-host mysql localhost
grep: /usr/local/hestia/data/users/admin/../../conf/mysql.conf: No such file or directory
Error: mysql host localhost doesn’t exist

There were errors while deleting.

That’s a bug I fixed a few days ago in this PR:

In v-list-database-host I removed is_object_valid “../../conf/$type” ‘HOST’ “$host” and added is_object_valid “../../../conf/$type” ‘HOST’ “$host”

And everything is the same:
root@hestiatest:~# v-delete-database-host mysql localhost
grep: /usr/local/hestia/data/users/admin/../../conf/mysql.conf: No such file or directory
Error: mysql host localhost doesn’t exist

Debian 12)

So, what are the consequences of deleting the local database server? What might not work?

It’s easier to hide it, of course. But after updating the panel, these changes will disappear.

sed -i -E 's|\.\./\.\./|\.\./\.\./\.\./|' /usr/local/hestia/bin/v-delete-database-host 

It worked.

The server was deleted. But if I leave mariadb running, will there be any issues updating the dashboard and working with the system? I just want a remote database server, not a local one.
Some service databases should remain on the local server.

I’m just asking you, as developers, what the possible consequences of such actions might be.

Roundcube currently depends on it ..

You can disable it..

Roundcube is needed.
If I set v-delete-database-host to mysql localhost but the actual mariadb server continues to run locally, will Roundcube still work? Or is this related?

I need a remote server for a small hosting project.

There are several large databases that don’t work properly on the server with hestiacp. The load is heavy. We decided to move them to a separate server.

Okay. If I type localhost in the template - /usr/local/hestia/web/add/db/index.php
Will the file be overwritten after updating the panel?
I just need to hide localhost so the client doesn’t create the database on the local server but uses the remote one. So it won’t show up in the panel. But there shouldn’t be any major consequences.

It’s probably best to do as sahsanu recommended.

Is it possible to add the ability to disable (not show) the localhost server when adding a remote server to the new version of the panel? I’m willing to donate a little to implement this feature.

I set v-suspend-database-host mysql localhost and commented it out in /usr/local/hestia/conf/mysql.conf

When creating a database, the local database server no longer shows up.

Please tell me, will this affect the operation of applications and the system as a whole?

Wondering if you ever found out if this had any negative repercussions/caused things to stop working? I’d like to hide the localhost connection from my users as well. I don’t need Roundcube though.

No problems. I haven’t seen any crashes. It works reliably. You can also hide localhost using a plugin.