Remove LocalHost and Uninstall MySQL Topic is solved

Questions regarding the Database Server
MySQL, PostgreSQL, MariaDB, Percona Server, phpMyAdmin, phpPgAdmin
Gordon55M
Posts: 36
Joined: Tue Apr 22, 2014 8:37 pm

Remove LocalHost and Uninstall MySQL

Postby Gordon55M » Mon Mar 27, 2017 5:20 pm

I've setup a remote database successfully on for all user databases to be used there. I suspended LocalHost

Code: Select all

/usr/local/vesta/bin/v-suspend-database-host mysql localhost

and everything is working great. However when I tried:

Code: Select all

/usr/local/vesta/bin/v-delete-database-host mysql localhost

I get the error:

Code: Select all

Error: host localhost is used

My question: is it possible to move all necessary localhost content to the remote database and completely remove MySQL from the main VestaCP install except for the MySQL connectors? If so, how would you do it? I am using Ubuntu 16.04.2 for both VPS's on Digital Ocean bound by private IP.

Lidocaine
Posts: 2
Joined: Tue Mar 28, 2017 12:47 am

Re: Remove LocalHost and Uninstall MySQL

Postby Lidocaine » Tue Mar 28, 2017 12:50 am

I've been trying to figure this out myself.

I was able to add a remote MySQL host without running/installing MySQL on localhost. However, when I open VestaCP and attempt to create a new database, the "Type" field is empty. As a result, I can't actually attempt to create a new database.

EDIT: If I manually edit the DOM to add 'mysql' as the type on the form, I am able to create the database. So, yes, it can be done, but there seems to be an issue with the Create Database form within VestaCP.

Is there a fix for this? It's rather annoying having to manually add-in a database type just to create one.

Lidocaine
Posts: 2
Joined: Tue Mar 28, 2017 12:47 am

Re: Remove LocalHost and Uninstall MySQL

Postby Lidocaine » Tue Mar 28, 2017 1:40 am

To OP, below are the steps I went through to get it working (excluding the issue in VestaCP). I'm running Ubuntu 16.04.2 on both my MySQL (v5.7) droplet and Webserver droplet (where Vesta is installed). I also never installed MySQL when I installed Vesta; I specifically opted out during installation.

Note:
y.y.y.y = my webserver droplet's private IP
x.x.x.x = my mysql droplet's private IP

  1. Create MySQL user to connect from webserver's private IP with all privileges:

    Code: Select all

    CREATE USER 'username'@'y.y.y.y' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON *.* TO 'username'@'y.y.y.y' WITH GRANT OPTION;

  2. Change the bind-address for mysqld (it's default in 5.7 is 127.0.0.1) to it's private IP. I had to add the following lines to /etc/mysql/my.cnf

    Code: Select all

    [mysqld]
    bind-address=x.x.x.x

  3. SSH'ed into my webserver and verified that I could connect to MySQL on my MySQL server by running:

    Code: Select all

    mysql -u username_from_step_1 -h x.x.x.x -p

  4. Upon verifying that worked, I added the remote host to Vesta via SSH using:

    Code: Select all

    v-add-database-host mysql x.x.x.x username_from_step_1 password_from_step_1

I hope this helps!

Gordon55M
Posts: 36
Joined: Tue Apr 22, 2014 8:37 pm

Re: Remove LocalHost and Uninstall MySQL

Postby Gordon55M » Tue Mar 28, 2017 2:41 am

When you install VestaCP without MySQL, what do you do for the connector? Add that in manually? I tried it once, and installing VestaCP without MySQL failed. Maybe I'll give that a try again tomorrow.

I have mine set to create users and databases no issue with the remote DB similar to Lidocaine's setup, but I want the local host MySQL gone completely.

Falzo
Posts: 40
Joined: Mon Mar 28, 2016 8:49 am

Re: Remove LocalHost and Uninstall MySQL

Postby Falzo » Tue Mar 28, 2017 7:52 pm

add --mysql no to the install command of vestacp and it doesn't install mysql in the first place. also there will be no phpmyadmin.

after you did add your remote mysql like @Lidocaine described you can add and use mysql on that vesta box. it will adjust the phpmyadmin-url for those databases to the domain of your remote mysql-host/phpmyadmin instead of the local one, so might want to have phpmyadmin running on that mysql-host to.

you probably could have phpmyadmin installed manually on your vesta server, but would then also need to change its configuration to the remote mysql.

PS: also roundcube might need some changes, as it relies on a database too.

Gordon55M
Posts: 36
Joined: Tue Apr 22, 2014 8:37 pm

Re: Remove LocalHost and Uninstall MySQL  Topic is solved

Postby Gordon55M » Tue Mar 28, 2017 7:55 pm

I figured it out. I'm planning on posting a whole tutorial, but here's quickly what I did. The key for me was adding in the the mysql-client on the web server early in the process (although it might not matter, my first try didn't work when I did it after the VestaCP install).

Code: Select all

apt-get update && apt-get upgrade && apt-get dist-upgrade
wget https://vestacp.com/pub/vst-install.sh
sudo apt-get install mysql-client
bash vst-install.sh --force --nginx yes --apache yes --phpfpm no --named yes --remi yes --vsftpd yes --proftpd no --iptables yes --fail2ban yes --quota no --exim no --dovecot no --spamassassin no --clamav no --mysql yes --postgresql no --hostname panel.yoururl.com --email me@yoururl.com --password ILikeCookies2

Gordon55M
Posts: 36
Joined: Tue Apr 22, 2014 8:37 pm

Re: Remove LocalHost and Uninstall MySQL

Postby Gordon55M » Tue Mar 28, 2017 9:37 pm

I just wrote up a guide for creating a VestaCP Webserver on Ubuntu 16.04 with a remote MariaDB Database Server also running on Ubuntu 16.04. Hopefully it helps someone out.

https://forum.vestacp.com/viewtopic.php?f=14&t=14220


Return to “Database Server”



Who is online

Users browsing this forum: No registered users and 2 guests