In a microwave-safe mug (at least 12 ounces), whisk together the flour, sugar, baking powder, and salt until no lumps remain.
Add the milk, melted butter, and vanilla extract to the dry ingredients. Stir with a fork until the batter is smooth with no flour streaks visible, about 20 seconds.
Gently fold in the well-drained crushed pineapple and shredded coconut, distributing them evenly throughout the batter.
Microwave on high power for 90 seconds. Check doneness — the top should look set and a toothpick inserted in the center should come out with moist crumbs, not wet batter.
If needed, microwave in additional 15-second intervals until just cooked through. Do not overcook or the texture will become rubbery.
Let the mug cake cool for 60 seconds before eating. The cake will firm up slightly as it cools and finish cooking from residual heat.