How to get safe in a foreign country the first time alone
Realize what you're dealing with.
Traveling in Canada is different from India which is different from China which is different from Chad. You don't need to be an expert on the country to be safe in it, but you need to be aware of your "natural" skill set and how it will match up with the place you are going. For instance, I'm from the US. When I go to Western Europe or Canada, I basically just show up on the doorstep in terms of doing research on infrastructure. My "native skill set," i.e., the way I was raised to understand how things work in the US applies virtually perfectly to those places. I have never been surprised in any of those countries in terms of figuring out how public transportation works or buying tickets or entering museums or knowing what to do if I'm injured, lost, sick, or in danger.
I live in Kazakhstan. I have a skill set for this place as well, but it's not my native skill set. For instance, here, it's completely normal to get around by standing on the side of the road and sticking out my hand. A random (non-marked-taxi) car will inevitably stop after a couple of seconds and the driver will roll down his window. I tell the driver where I'm going. If it's not terribly out of the way for the driver, he'll ask me how much I want to pay. If we agree on the price, I hop into the back of the car and he takes me there. I would never do this in the US or Western Europe or Japan. This is not normal there, and could even potentially be unsafe. But here it's just as normal as getting on a bus.
If I'm ill in the United States or Western Europe, I go to the drug store or a grocery store and pick up some tablets. Here, I have to go to an apteka marked with a green cross, where everything is "behind the counter," even basic pain and cold meds. This isn't rocket science, but you can't just walk into a general store and get ibuprofen. You have to go somewhere specific and you need to know where to go.
So you need to know what's normal.
You also have to know at least a bit of the local language, even if you speak English well. You don't have to be a linguist to do this. At bare minimum, be able to ask people if they speak English/your preferred language. It's rude to go around accosting people with a language not native to the country. In addition to being polite, it will also have the effect of charming people (hey, at least you're trying) most of the time and will result in more help. A couple of hours on Duolingo or whatever works wonders.
Understand basic cultural norms. Is it normal for women to travel alone? Is it normal to shake hands or is there another, more common greeting? How are waiters summoned? What does a smile mean? Are the police suspect to bribing? What's normal with alcohol consumption? Understand the laws of cultural normality. You don't have to agree with them or even adhere to them entirely - you are foreign - but understanding them is going to go a long way toward making your trip go smoother.
Understand where you're going. Wandering around with your nose in a map will make you look vulnerable because it advertises you are not familiar with your surroundings. Walk with purpose. Stay away from dark areas, and if your spidey sense is going off that something is wrong, it probably is. Move.
If you have access to a SIM card and a cell phone, it's advisable to keep your embassy's phone number on you, just in case. It's also advisable to have a copy of your lodging's address on you, written in local language. (If you are staying in a hotel/hostel/B&B, ask for a business card. If you are staying with local hosts, ask them to write it down for you.) This way, if all else fails, you can get a cab and just hand over the address.
Dress appropriately. I've traveled in countries where most women cover their hair, and I don't and didn't. It's not necessary to do (most of the time). However, in those countries, it's typical for women to dress more modestly than they do where I'm from. It's advisable to stick to this.
Know the basics of local law. There are some countries where defiling pictures of the country's leader or making negative remarks about him/her (though, in these countries it's probably a 'him') can land you in serious hot water. You should know this. Is it required for you to carry your passport everywhere?
I also recommend being at least somewhat up on the history and current news of the place you're going to. Again, you don't have to be a scholar, but if you can recite some main points of the country's history (preferably some positive ones) and be up on a couple of (non controversial) news stories, this will give you something concrete to talk about with your hosts and likely please them. Sports can do very well for this. Do you like soccer? I suggest you start if you don't. I can't tell you how far the international language of 'the football' has gotten me in most parts of the world.
Other than that, the basics. Don't flaunt expensive jewelry. Don't go around with wads of cash in your hand. Don't wander around drunk in dark alleys at night alone.
It's not that hard.
I would suggest you act like you are safe, and that you feel confident. I remember a guy in Abu Dhabi airport watching me withdraw cash, and I just looked him in the eye and smiled. It's in a bright public place, what was he going to do? (nothing!) And I'm a woman in an international place withdrawing cash - which in UAE shouldn't be that shocking!
Walk with purpose in your stride - a little like you're in a hurry. A 'don't mess with me' style.
Talk to people though - be open, say hello or thank you.
Remember most people are normal people like you - they just want to get on with life. They aren't out to hurt you or swindle you. Try to trust your gut, but don't assume the worst in everyone.