CONTEXT: In this psalm of confidence (expressing faith in God), the psalmist trusts that God will preserve him in a time of distress. He begins by expressing his confidence in God, who he describes as his rock and salvation (vv. 1–2). He then addresses his enemies and describes their wickedness (vv. 3–4) before reiterating his trust in God (vv. 5–7). He encourages the congregation to put their trust in God as well (v. 8), warning them not to trust in people or in riches (vv. 9–10). The psalmist concludes by showing his confidence in God by noting God’s promises (vv. 11–12). – FaithLife Study Bible
v.6 He only is my rock and my salvation; My fortress and my defense, I will not be shaken or discouraged. is basically a repeat of v.2. If you remember anything from school anytime a teacher repeated themselves it was usually important (and on a test). While this may not be testable in that sense it is very important. for David is making the declaration that there is only one true God and he has and will continue to put all his trust and confidence in Him alone.
He only is my rock and my salvation. Alone, and without other help, God is the foundation and completion of my safety. We cannot too often hear the toll of that great bell only; let it ring the death knell of all carnal reliances, and lead us to cast ourselves on the bare arm of God. He is my defence. Not my defender only, but my actual protection. I am secure, because he is faithful. I shall not be moved –not even in the least degree. See how his confidence grows. In the second verse an adverb qualified his quiet; here, however, it is absolute; he altogether defies the rage of his adversaries, he will not stir an inch, nor be made to fear even in the smallest degree. A living faith grows; experience develops the spiritual muscles of the saint, and gives a manly force which our religious childhood has not yet reached. – C.H. Spurgeon
Reader, do not fail to remark how quickly the soul of the faithful returns again to the God of his confidence. We may spare a moment to admonish the ungodly, but our own joy must not be long broken in upon; we are to hold fast, and, like the dove of Noah, return back to the ark, even Christ Jesus, the sole joy of our salvation. And, Reader, do observe further, how the expressions of this holy confidence are repeated, and with every pleasing variety, that may denote the comfort of the heart. Pause, and ask yourself, Are such views of Christ, your views of him? Do you know him in those covenant characters? Is Jesus your rock, your salvation, your defense? – Hawker’s Poor Man’s Commentary Psalms 62 v.5-7