Page 1 of 1

Remove LocalHost and Uninstall MySQL

Posted: Mon Mar 27, 2017 5:20 pm
by Gordon55M
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.

Re: Remove LocalHost and Uninstall MySQL

Posted: Tue Mar 28, 2017 12:50 am
by Lidocaine
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.

Re: Remove LocalHost and Uninstall MySQL

Posted: Tue Mar 28, 2017 1:40 am
by Lidocaine
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!

Re: Remove LocalHost and Uninstall MySQL

Posted: Tue Mar 28, 2017 2:41 am
by Gordon55M
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.

Re: Remove LocalHost and Uninstall MySQL

Posted: Tue Mar 28, 2017 7:52 pm
by Falzo
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.

Re: Remove LocalHost and Uninstall MySQL

Posted: Tue Mar 28, 2017 7:55 pm
by Gordon55M
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 [email protected] --password ILikeCookies2

Re: Remove LocalHost and Uninstall MySQL

Posted: Tue Mar 28, 2017 9:37 pm
by Gordon55M
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.

viewtopic.php?f=14&t=14220