Remote Database Setup

Its pretty clear that the installation does not know where the MySQL is or its not installed

Before anything make sure you have everything setup as per #Post 6 if your install is a remote db based one if its a regular install, please follow instructions on EPRNext wiki

Hey @saidsl, already used these commands but still getting error.

@Saditi
Unless you install mysql or do a complete install you are not going to get much further. As I mentioned, your MySQL DB is not installed. Be it locally or remotely.

So please check that you have the right setup before progressing further

Hello @saidsl,

Changes in instance server:
common_site_config.json

Changes in database server:
Mysql changes :

This is my my.cnf file :

Error while creating new site:

I can’t connect to the mariadb on other server:

ERROR 2002 (HY000): Can't connect to MySQL server on '10.10.128.209' (115)
  • Should I open any port on the ERPNext server or Mariadb server?
  • Is there any difference between connect using public or private IP?
  • In the db server should I install bench too? Or is it able only MariaDB?
  • Do I need to connect to certain database (of a site) or can it connect to mysql?

Thank you for any help.

Setup the remote DB to accept remote connections :

in /etc/mysql/my.cnf or /etc/my.cnf

comment out:
bind-address=0.0.0.0

bench mariadb

mysql -uuser -ppass

GRANT ALL PRIVILEGES ON . TO user@% IDENTIFIED BY ā€˜pass’ WITH GRANT OPTION;

only for specific user and database (example):

GRANT ALL PRIVILEGES ON [Database_Name].* TO *[User_Name]*@% IDENTIFIED BY ā€˜[Password]’ WITH GRANT OPTION;

Restart remote MySQL

sudo service mysql restart

1 Like

Hi @Ernesto,
Sorry for not responding for too long.

There is no bind-address in my.cnf
but there is in /etc/my.cnf.d/mariadb-server.cnf and it’s already commented out.

It connects to a database [_xxxxxx].
Should it be to the root as it is for multi tenants.

Get a syntax error.

Hi Said, Do you have a clue about using the Azure Remote Database for Mariadb ?

Apparently the above steps won’t work with that (works perfectly with the rest).

Hi @Shinzuco - Unfortunately, I have not worked with Azure Remote DB. The setup outlined was meant for Linux based server setups.

However, It should not be any different to other setups in that, if you can access the DB externally than you would be able to connect to it.

You might want to look at the privileges/permissions on your Azure DB and whether external connections are permitted. I know some require tokens etc.

Regards - Said

It’s fairly easy to set up , the problem with Azure Remote DB is it accepts username in a ā€œusername@hostnameā€ format and this conflicts with frappe’s code which uses ā€œusernameā€ to create new db’s manage access etc.

@Shinzuco
I had also faced the same issue when I was trying to use RDS MariaDB and I resolved using just change the username in RDS MariaDB.

Yeah, it works for amazon since the username expected is in ā€œusernameā€ format. Azure requires it to be sent in username@hostname format in the connection string and this cannot be changed from azure’s side afaik. We might need to customize database.py

If I am hosted by Erpnext.com can I Remote Database?

Thank you for your help!