HeidiSQL cannot connect to database inside a Linux VM

Whenever I try to connect to my database an error comes up that reads: “Lost connection to MySQL server at ‘reading initial communication packet’, system error 0”. Most people suggest it has to do with an option “bind-access” which should be inside the my.cnf file. However I don’t have it inside the file and adding it didn’t seem to do much of anything. Does anyone have any idea or suggestion on what I should do?