In 5G systems, a predefined codebook with a limited number of beams is used during the initial access and beam management procedures to establish and maintain the connection between the users and the network. At 5G mmimeter wave (mmWave) frequencies, due to the very narrow and directional beams obtained by beamforming, intelligently designing a codebook with a limited number of beams is crucial to avoid coverage holes. We formulate an optimization problem for the beam-codebook design to maximize the coverage probability, which is a quadratically-constrained mixed-integer problem. We propose a set of data-driven codebook design algorithms to solve the optimization problem, which, for a given codebook size constraint, adapts the codebook to the deployment scenario using the provided input channel data. For a sample deployment scenario, we show that as the codebook size increases, the proposed algorithms converge to the upper bound in terms of the coverage probability much faster than several benchmark algorithms. Hence, the proposed algorithms can achieve the coverage levels of benchmark algorithms with a much smaller codebook size. This can significantly reduce the initial access, beam management, and handover delays, which in turn provide higher data rates, lower latency, and lower interruption times.