Yes, it happens.
Going into EVE Online and expecting never to be ganked (even in highsec) is fundamentally misunderstanding the game. EVE is a fairly old school MMO, and while some concessions have been made towards making certain areas of the game more safe the whole purpose is to create an environment driven by player interactions, so if players want to gank you they can. The only way you can stop them is by making yourself as unattractive a target to gankers as possible and by trying to avoid coming into contact with them.
If you're used to playing MMOs like single player games, gankers might seem like griefers who are not playing by the rules. However, there's a completely different way of looking at it, in that gankers are also creating player driven content for miners and industrialists which wouldn't otherwise exist, which is ultimately the point of the game. If you were just mining in a safe environment, slowly watching the ISK go up, then what happens when you finally get enough money and skills to buy that exhumer? Many people get to that point and quit the game, because they think they've "won", they've got the biggest mining barge, but there's nothing to do with it except mine more so why continue. They've never been exposed to "the real EVE", so why should they by incentivized to get involved in it in any way. In that sense, while it might seem cruel, gankers are bringing a little of the player driven interaction which the game is actually about into highsec, and if you're the kind of person who is likely to enjoy EVE that is actually a good thing.
That said, you can avoid gankers with almost complete certainty by just understanding how they operate. Gankers want to destroy expensive targets because they judge their success by the value of ships they have destroyed. They want easy targets which they can destroy with only a small number of ships, because once they strike in hisec their own ships are targeted for destruction by CONCORD. Finally, if they do gank you they want you to rage and have an emotional response, because it vindicates them and shows that you aren't emotionally in the right mindset. Get a Procurer, tank it up with shield boosting modules and rigs, be situationally aware, don't mine AFK and always be polite and the chances of anyone ganking you are basically zero. The Procurer's mining yield is really not much lower than the other mining barges, and it's very seldom cost effective to gank one unless you've filled it with very expensive components.
Finally, if you do get ganked, absolutely do not rage. Strike up a conversation with them, congratulate them on a successful PVP and, if you have the money, place a bounty on them. Sometimes they will be genuine assholes, but there are assholes everywhere (including among the players who just want to mine in peace) sometimes they will come across as quite unhinged (although a lot of that is roleplay) but more often once they realize you aren't going to give them tears they will turn out to be okay people. Don't buy a mining permit, it won't keep you safe as well as a well-tanked procurer (there are a few exceptional cases where buying a mining permit may be a good idea, but you'll generally figure out if you're in one of those situations). Finally, if you find you're running into gankers regularly, consider moving to a less populated system. Hisec is big, and there are not many gankers in it.
For the record, I am a trading/industrial player and have never ganked, but there comes a point when you get sick of watching multiboxers flying around in swarms of untanked barges, hoovering up all the ore with impunity. That's in many ways far more infuriating than gankers, because even if you're being the best miner you possibly can you can't beat those people. They're competing with you, driving down the price of your ore and abusing the protection of hisec to ensure noone can stop them. Gankers provide a means by which you can beat those people, by making it more likely that they get targeted and you don't.
Going into EVE Online and expecting never to be ganked (even in highsec) is fundamentally misunderstanding the game. EVE is a fairly old school MMO, and while some concessions have been made towards making certain areas of the game more safe the whole purpose is to create an environment driven by player interactions, so if players want to gank you they can. The only way you can stop them is by making yourself as unattractive a target to gankers as possible and by trying to avoid coming into contact with them.
If you're used to playing MMOs like single player games, gankers might seem like griefers who are not playing by the rules. However, there's a completely different way of looking at it, in that gankers are also creating player driven content for miners and industrialists which wouldn't otherwise exist, which is ultimately the point of the game. If you were just mining in a safe environment, slowly watching the ISK go up, then what happens when you finally get enough money and skills to buy that exhumer? Many people get to that point and quit the game, because they think they've "won", they've got the biggest mining barge, but there's nothing to do with it except mine more so why continue. They've never been exposed to "the real EVE", so why should they by incentivized to get involved in it in any way. In that sense, while it might seem cruel, gankers are bringing a little of the player driven interaction which the game is actually about into highsec, and if you're the kind of person who is likely to enjoy EVE that is actually a good thing.
That said, you can avoid gankers with almost complete certainty by just understanding how they operate. Gankers want to destroy expensive targets because they judge their success by the value of ships they have destroyed. They want easy targets which they can destroy with only a small number of ships, because once they strike in hisec their own ships are targeted for destruction by CONCORD. Finally, if they do gank you they want you to rage and have an emotional response, because it vindicates them and shows that you aren't emotionally in the right mindset. Get a Procurer, tank it up with shield boosting modules and rigs, be situationally aware, don't mine AFK and always be polite and the chances of anyone ganking you are basically zero. The Procurer's mining yield is really not much lower than the other mining barges, and it's very seldom cost effective to gank one unless you've filled it with very expensive components.
Finally, if you do get ganked, absolutely do not rage. Strike up a conversation with them, congratulate them on a successful PVP and, if you have the money, place a bounty on them. Sometimes they will be genuine assholes, but there are assholes everywhere (including among the players who just want to mine in peace) sometimes they will come across as quite unhinged (although a lot of that is roleplay) but more often once they realize you aren't going to give them tears they will turn out to be okay people. Don't buy a mining permit, it won't keep you safe as well as a well-tanked procurer (there are a few exceptional cases where buying a mining permit may be a good idea, but you'll generally figure out if you're in one of those situations). Finally, if you find you're running into gankers regularly, consider moving to a less populated system. Hisec is big, and there are not many gankers in it.
For the record, I am a trading/industrial player and have never ganked, but there comes a point when you get sick of watching multiboxers flying around in swarms of untanked barges, hoovering up all the ore with impunity. That's in many ways far more infuriating than gankers, because even if you're being the best miner you possibly can you can't beat those people. They're competing with you, driving down the price of your ore and abusing the protection of hisec to ensure noone can stop them. Gankers provide a means by which you can beat those people, by making it more likely that they get targeted and you don't.