Remote Database Setup

Steps to setup Remote Database

  1. Setup the remote DB to accept remote connections, In /etc/mysql/my.cnf or /etc/my.cnf comment out
    1.1 # bind-address=0.0.0.0
    1.2 # skip-networking (on later versions of mariadb this is not present)

  2. On the remote DB in mysql enter:
    Grant Privilegies to root as GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '[ROOT-SQL-PASSWORD]' WITH GRANT OPTION;

  3. Restart remote MySQL
    sudo service mysql restart

  4. Add remote IP or Address to the local instance
    bench set-mariadb-host [REMOTE-MySQL-IP/ADDRESS]

  5. So changes are applied do:
    bench restart

  6. Test the connection using bench mysql if everything is working fine you should be able to connect to the remote DB server.

  7. Create new site using:
    bench new-site site1.remote --install-app erpnext --verbose
    IMPORTANT Create the site only after you are able to connect to connect to the MySQL using bench mysql, otherwise the site will not be created. you should see the following:

frappe@ERPNext:~/frappe-bench$ bench new-site site1.remote --install-app erpnext --verbose MySQL root password: Created user a1947c1ffeceb24a Created database a1947c1ffeceb24a Granted privileges to user a1947c1ffeceb24a and database a1947c1ffeceb24a Starting database import... Imported from database /home/frappe/frappe-bench/apps/frappe/frappe/data/Framework.sql Installing frappe... Updating frappe : [========================================] Updating country info : [========================================] Set Administrator password: Re-enter Administrator password: Installing erpnext... Updating erpnext : [========================================] *** Scheduler is disabled ***

Reboot the server

16 Likes