League One side Blackburn host Premier League rivals Burnley in a Lancashire derby, with the draw regionalised.
Newcastle will host Nottingham Forest, with Bournemouth away to Birmingham, among six ties with Premier League sides facing Championship opposition.
The draw initially left several sides unsure whether they were home or away.
The second-round ties will be played in the week commencing Monday, 21 August.
The seven Premier League teams involved in European competition will enter at round three.
Amid confusion during the live broadcast, four second-round matches were announced with the incorrect team away from home.
The ties involving seeded sides Brentford, Crystal Palace, Watford and Norwich City were initially read out with the seeded team at the opposite venue.
West Ham and Newport County were guaranteed away games regardless of how they were drawn, owing to being unable to play at their home grounds.
The Hammers - whose London Stadium home is being used for the World Athletics Championships - will visit League Two team Cheltenham, while Newport - whose pitch is being relaid - travel to Leeds.
Confusion also reigned in the first-round draw in June, which was streamed live from Bangkok, as Charlton were included twice on a graphic listing the fixtures, while AFC Wimbledon were also wrongly recorded as being at home to Swindon in that round.
QPR v Brentford*
Crystal Palace v Ipswich Town*
Watford v Bristol City*
Norwich City v Charlton Athletic*
Cheltenham Town v West Ham United**
Brighton & Hove Albion v Barnet
Cardiff City v Burton Albion
Southampton v Wolverhampton Wanderers
Fulham v Bristol Rovers
Milton Keynes Dons v Swansea City
Birmingham City v Bournemouth
Reading v Millwall
Carlisle United v Sunderland
Bolton Wanderers v Sheffield Wednesday
Accrington Stanley v West Bromwich Albion
Newcastle United v Nottingham Forest
Leeds United v Newport County**
Stoke City v Rochdale
Huddersfield Town v Rotherham United
Middlesbrough v Scunthorpe United
Doncaster Rovers v Hull City
Blackburn Rovers v Burnley
Sheffield United v Leicester City
Aston Villa v Wigan Athletic
Barnsley v Derby County or Grimsby Town
*These ties were initially announced with the other team at home
**West Ham and Newport County would not play at home, as per a pre-draw agreement
Last season's losing finalists Southampton will host Championship club Wolves in the EFL Cup second round after Thursday's confusing live draw.