We have proposed a density-matrix renormalization group (DMRG) scheme to optimize the one-electron basis states of molecules. It improves significantly the accuracy and efficiency of the DMRG in the study of quantum chemistry or other many-fermion system with nonlocal interactions. For a water molecule, we find that the ground state energy obtained by the DMRG with only 61 optimized orbitals already reaches the accuracy of best quantum Monte Carlo calculation with 92 orbitals.