How to socialize at pubs/bars when you are alone?
Let's box this in by limiting your intent to merely socializing.
Over the years, I've socialized with many hundreds of people in all sorts of venues. The fact that this particular venue is a pub/bar or features music isn't particularly special.
Socializing can happen anywhere where there's a group of people. What makes it a lot easier is if people are grouped because of a shared interest. The same applies similarly to other venues such as cruising, theme parks, sporting activities, fan cons, etc...
In the case you present, that shared interest is more the type or form of music. So, being conversational in that genre is very helpful.
I was used to find socially acceptable to greet only people I know or people which is obvious that I'm going to interact with (OP's comment)
Look at it this way, there's actually lots of people it's 'obvious' you can interact with, you just need to find the connection.
Here's two 'ins' you can easily leverage to break the proverbial ice.
- Recognize something about their presentation (clothing, jewelry, etc) that indicates a commonality between you and them. A t-shirt for a band you enjoy or a place you're been, a necklace from a culture you know about, doesn't have to be much. Then quickly form a non-intrusive question or compliment about that and serve it up.
- Unintentional eavesdropping. You will often just overhear random conversations (seriously, don't really eavesdrop) and recognize something you're familiar with. Then casually offer a relevant and interesting point.
I've used both of these in attraction lines to pass the time.
The first Interpersonal Skill you should develop is judging their reaction. Don't make it awkward. If they don't really react or engage back, just let it go. Then if they do engage, be sensitive to that engagement breaking down, and then let it go. If you are new to this, I recommend being overly cautious. The risk is you may come off as pushy or creepy.
Not every engagement will work out, but over time, you can definitely learn how to be a sociable and engaging person.