Next, play chords from your Mac keyboard with Chord Pad. Free to try.
The D major pentatonic is the D major scale without its 4th and 7th, G and C♯. Without those two half steps nothing clashes, so it sounds sweet over any chord in the key: country, pop and soul solos live here.
On the neck the scale repeats in five boxes. Box 1, from the 9th fret, has D on the low E string under your middle finger. It's the same shape as Box 2 of B minor pentatonic: the same notes, with a different note as home.
The same scale in all twelve keys, and its relatives, are on the pentatonic scale page. Pick a key there, or play this one in another box above.
D, E, F♯, A and B.
Same five notes, different home note: B minor pentatonic starts on B. Over a D major chord they sound major; over B minor, minor.
Over major chords and happy songs. Over a D blues, mix the two: the minor one sounds bluesy, the major one sweet.