This paper studies the issue of data-driven optimal control design for connected and autonomous vehicles (CAVs) in a mixed-traffic environment. More specifically, we investigate the controllability of a string of vehicles composed of multiple CAVs and heterogeneous human-driven vehicles in a ring road. We use the classical Popov-Belevitch-Hautus (PBH) test to single out the uncontrollable mode, and identify the controllable subspace, based on which we obtain an explicit transformation matrix for Kalman controllable decomposition. Combining with the decomposition result, we formulate a linear quadratic regulator problem with constrained initial states and employ the adaptive dynamic programming method to solve it without relying on the exact knowledge of system parameters. The convergence of the data-driven algorithm has been proved rigorously. The simulation result shows that our theoretical analysis is effective and the proposed data-driven controller yields desirable performance for regulating the mixed-traffic flow.