To give a sense of scale, the USS Washington firing on the IJN Kirishima in the Second Battle of Guadalcanal is reckoned as one of the shortest-range engagements in WWII... at about 5km.
That said, the remaining ships in the area were the surviving Japanese destroyers, and destroyers closing in closer to ships would not be unusual. Furthermore, the Yamato was in the process of abandoning ship at this point, and the destroyers may have been closing in to help fight fires or rescue survivors. I doubt they'd be closer than about a km from the ship at the time of the explosion, and none of the Japanese ships (so far as I'm aware) reported any effect from the explosion. Some planes (up to 7) were lost in the fireball, though.
Also in the WW2 battle of Singapore, two British battleships were sunk by Japanese bombers, but the Japanese ships were very close to the British fleet at times. The result was that Japan dominated both the Pacific and Indian oceans until Midway.
Since it was a ground level explosion, the quay and other buildings probably largely shielded the hulls of the ships from damage.
Ships in general are quite sturdy things, they are made to withstand heavy seas and winds after all.