Autoguns are just that inaccurate...

/shoots at turret
/hits and aggros every enemy in the room except the turret I was aiming at

Or you could use a magnus charge or an alchemer charge to just kill the turret immediately.
The thread raises a good point that is often overlooked: Autogun charges do insane damage to a nearby target, but spread out too much to do insane damage to distant targets.

They aren't just inaccurate, they're also very high damage.
You should really be getting right up there in their face, not spraying them from far off. The one exception to this is if there is a crowd of enemies, in which case spraying the crowd from a few tiles away won't lose any damage overall but will likely be safer for your knight.

In that particular moment, I was shooting at a Howlitzer.
If I shot at close range, it would blow up in my face.
(It also had low HP. It would take too much time to charge when I could deal damage right away.)
(My best gun is an Autogun. I don't own/only own a low star version of the others.)

Yo, get closer. Autoguns are the shotguns of Spiral Knights. You'd think it would be Magnus but no, Autoguns are the true shotguns. If you can't handle the spread as often as you'd like, consider investing in a Valiance or an Iron Slug, which can have similar damage output to Volcanic Pepperbox but have better defensive options, or a Tortofist if you want to retain the Crowd Control purposes on charge while still retaining heavy damage with regular shots and having a similar playstyle to Autoguns.

I'm confused, Volcanic Pepperbox has insane knockback and with a slight spacing would easily allow you to not only one-shot a Howlitzer, but also take out its kamikaze head within the same charge. If that proves too difficult, shooting it with a regular shot takes its health down very quickly, and with shield canceling and switch-shooting you should never have any moment of time where you are in danger unless you're surrounded by 50 Kats and a Trojan while taking the Howlitzer down. And it's not even something you have to practice-- press attack, press shield, swap weapon, swap weapon, repeat. Even if you moved as slow as molasses you can stand literally right beside a Howlitzer without getting punished.
If you perhaps mean the hard part is actually getting beside a Howlitzer, you can outright dash through their bullets, or space properly and shieldbash them, the stun will prevent them from doing basically anything for the rest of eternity. If you consistently have trouble shieldbashing, stay on the lookout for Stun Vials any time you can whenever you're in Undead stratums. Additionally, you can use Drakon's Flame Barrier to minimize the damage taken to you, or Maskeraith's Shadow Cloak to get a free charge off, or Seraphynx's Light Ray to destroy the head after you kill the Howlitzer so you don't get punished from any endlag.

I didn't want to take the time to charge, and the regular shot which I used missed and aggroed all the other enemies, as I mentioned in the OP.
If I went closer to the Howlitzer so I would hit, I would blow up from the head.

"If I went closer to the Howlitzer so I would hit, I would blow up from the head."
Again, I'm confused. Can you explain how? Also, as I mentioned, "Additionally, you can use Drakon's Flame Barrier to minimize the damage taken to you, ... or Seraphynx's Light Ray to destroy the head after you kill the Howlitzer so you don't get punished from any endlag."

I didn't want to wait 20 seconds to be able to re-activate my flame barrier.
(Besides, I had low HP. I'm not sure I would be able to take a hit without dying.)

Then that's certainly more reasonable, but why not shield bash? And if your shield was too low at the time to shieldbash, you could have used a barrier/vial to stun/shock/freeze the Howlitzer so you can safely close the distance, or cause Fire on it so you can deal some damage while waiting for a more optimal time to punish. Sure, waiting isn't fun, but it's better than uh....
"/shoots at turret
/hits and aggros every enemy in the room except the turret I was aiming at"

Also, usually I think that "vials and barriers are useless", so I just throw them. They only take up space for more useful things (health capsules, remedy capsules, recon rangers/mecha knights/artillery strikes) and move my health capsules and remedy capsules (I'm used to them being in slots 4 and 5). I had none.

Actually, I find barriers to be pretty good. They basically give extra sword damage for close range.
Vials kinda suck for me.

Hah, mecha knights as useful things, are you playing in stratum 1? Art strikes are meh, recons ARE useful, gotto admit that.
In case you didn't know, vials can neutralize ANY projectile in the game, including bullets, spikes, axes, rockets, etc, even temporarly canceling out lasers (from battlepods and on the twins levels); howlitzer heads also count as projectiles. After it is dead and goes into its torpedo mode, just wait a split of a second and throw a vial at it and it will explode. You have to wait a bit, because if you throw the vial too early, it won't do anything, the heads are invincible for that small amount of time.
And as Dibs said, dashing also makes projectiles go puff, you can dash across any of the above listed things (and orbital chains as well). So not only you won't take damage but the projectiles will also be gone, making life easier - most notable examples are rockets and the heads.
If you are next to/near a howliter when it dies, just shieldbump it away, this can open up oppurtunities to either run away, vial it, dash across it, or shoot it down.
Sorta reminds me of this to be honest.
Argent Peacemaker or a Pulsar line would probably be your best bet if you're shooting for pups. Though for all turrets, a good tortofist charge can take off a lot of health and shoot you away from the turret before it hits you.