This paper is on the resource allocation problem for pilot-assisted multi-user massive multiple-input-multiple-output (MIMO) uplink with linear minimum mean-squared error (MMSE) channel estimation and detection. We utilize the angular domain channel representation for uniform linear antenna arrays, and adopt its equivalent independent and nonidentical distributed channel model. For a given coherence interval and total energy budget, we study the joint optimization of the training length and the training power to maximize the achievable sum-rate. For tractable analysis and low-complexity solution, a tight approximation on the achievable sum-rate is derived first. Then the training length optimization for fixed training power and the training power optimization for fixed training length with respect to the approximate sum-rate maximization are both shown to be concave. An alternative optimization that solves the training length and power iteratively is proposed for the joint resource allocation. In addition, for the special case that the training and data transmission powers are equal, we derive the optimal training lengths for both high and low signal-to-noise- ratio (SNR) regions. Numerical results show the tightness of the derived sum-rate approximation and also the significant performance advantage of the proposed resource allocation.