It's slightly more complicated than what you might expect, since from the Cloud Shell you're actually connecting from a different machine than the one your Cloud SQL instance is running on.
Instead of '127.0.0.1', you need to pass the instance's real external IP address (which you can get from the Cloud Console under 'SQL'). You also need to authorize the Cloud Shell machine's external IP address (which you set under 'SQL' -> <instance> -> 'Access Control'). You can get the external IP using some web service eg.
The IP can potentially change every time you start a new Cloud Shell. None of this would be necessary if if '
gcloud beta sql connect' allowed you to pass extra flags to the 'mysql' client, but alas it currently does not. Hopefully this feature will exist when the command leaves beta, but if it doesn't it would be a perfect candidate for a
feature request.