Not clear what exactly do you want to do:
To work with the database server running within any Arduino, but interfacing with ESP8266 module ? To work with the database server running at the cloud ( or anywhere), but getting access via mobile ? To work with the database server running within the mobile platform ? To work with the database server running within ESP8266 core itself, but acting as CPU instead of as a shield ( a FIREBASE library ) ?
Whenever you specify a system consisting of multiplatform devices, you should preferably to make a diagram or be very clear as to the task assigned of each part of the whole,