If you forget everything: just smile, point at yourself, and say “Soy [your name].” Then point at them and raise your eyebrows. It’s caveman Spanish, but it works. I’ve seen a tourist use this with a grunt and a thumbs-up, and she got a drink and a new best friend.
And if all else fails, say “¿Cómo te llamas?” with a shrug. If they laugh, you’re fine. If they stare blankly, you’ve probably asked them to name a potato. Either way, it’s a memorable story.
Go forth, ask names, and remember: Spanish is just English with better vowels and more passion. ¡Buena suerte! (That’s “good luck”—but say it like you’re about to win a dance-off.)