You probably can't usefully set up HPA on the database. MySQL and PostgreSQL are usually single nodes, or if they have multiple nodes, they run in an active/standby mode, so adding nodes won't necessarily add capacity. (Even with a clustered database, there can be practical problems with setting up HPA around scale-in.)
You can set up HPA on the application. It's helpful to understand what the limiting factor on your application actually is: if you send enough load that it starts being slow or failing requests, is it starved for CPU time, out of memory, or waiting on the database? That would affect what parameters you'd want to set on the HPA.
One realistic situation is that your application does some database queries, which take the bulk of the time, and then very quickly renders the data to HTML or JSON. In this situation it will be hard to take advantage of HPA: the single-node database is hard to scale, and even if you scale up the application pods, you'll still be blocked on database queries.