micheleur your solution seems more complex than simply installing the User Directory extension (which was released after this thread was originally created), going to the user profile and delete it from there.
You should take into consideration that any "on delete" behaviour defined by an extension will not run if you delete a user manually from the database. This could potentially lead to invalid state for some extensions. If you wish to develop a remote/automated tool, you should use the Flarum REST API to delete a user and trigger any related Flarum event.
I see you just joined the community. I invite you to take a look at the very complete (and still evolving) Flarum extension API that lets you add almost any new feature into Flarum as an extension.