Entanglement-assisted quantum error-correcting (EAQEC) codes could generalize and improve performance of standard quantum error-correcting (QEC) codes to a great extent. In this paper, series of EAQEC codes of length $$n=\frac{q-1}{a}(q+1)$$ are constructed from cyclic codes and negacyclic codes, where q is a prime power and a is a positive integer such that $$a\mid (q-1)$$. It turns out that the number of required entanglement bits can take almost all possible values. Consequently, our EAQEC codes have flexible parameters and most of them are new. For given the same length, our construction contain and extend those known consequences in Grassl et al. (Int J Quantum Inf 2(1):55–64, 2004), Jin et al. (IEEE Trans Inf Theory 56:4735–4740, 2010), Kai et al. (IEEE Trans Inf Theory 60:2080–2086, 2014), Jin and Xing (IEEE Trans Inf Theory 60:2921–2925, 2014), Chen et al. (IEEE Trans Inf Theory 61:1474–1484, 2015), Zhang and Ge (IEEE Trans Inf Theory 61:5224–5228, 2015; Des Codes Cryptogr 83(3):503–517, 2016), Shi et al. (Cryptogr Commun 10(6):1165–1182, 2018; Finite Fields Appl 46:347–362, 2017), Fan et al. (Quantum Inf Comput 16:423–434, 2016), Lu et al. (Quantum Inf Process 17(69):1–23, 2018), Li et al. (Int J Quantum Inf 17(1):1950022, 2019), Liu et al. (Quantum Inf Process 17(210):1–19, 2018), Fang et al. (Euclidean and Hermitian Hulls of MDS Codes and Their Applications to EAQECCs. arXiv:https://arxiv.org/abs/1812.09019v3). Above all, all our codes are maximum-distance-separable (MDS) if their minimum distance $$d\le \frac{n+2}{2}$$.