A method for transmitting data, the method comprising: transmitting, by a terminal, a first preamble to a base station, and receiving a first random access response, RAR, message transmitted by the base station; obtaining, by the terminal, an uplink transmission resource based on the first RAR message, and transmitting first uplink data on the uplink transmission resource, wherein a size of the uplink transmission resource supports the transmission of the first uplink data; and obtaining, by the terminal, a to-be-transmitted media access control protocol data, MAC PDU, from a multiplexing and assembly entity as the first uplink data, wherein the multiplexing and assembly entity is configured to package uplink data to be transmitted into the MAC PDU; wherein the step of transmitting the first uplink data on the uplink transmission resource comprises: checking a first buffer, by the terminal, whether data is stored therein, the first buffer being configured to store the MAC PDU in a msg3; and when the first buffer has data stored therein, obtaining data, by the terminal, from the first buffer; characterized in that when a size of the data in the first buffer is greater than the size of the uplink transmission resource, then: indicating, by a MAC layer entity of the terminal, a transmission failure of part or all of Radio Link Control protocol data units, RLC PDUs, comprised in the data in the first buffer to a Radio Link Control acknowledge mode, RLC AM, entity transmission side, wherein the RLC AM entity transmission side retransmits part or all of the RLC PDUs after receiving the indication; wherein when a downlink control channel that schedules the first RAR message is scrambled by a first radio network temporary identity, RNTI, and a random access, RA, process currently performed by the terminal is triggered by beam failure recovery, BFR, the terminal deletes the data in the first buffer; the first RNTI is selected from a plurality of RNTIs,, wherein the the plurality of RNTIs at least comprises a cell-radio network temporary identity, C-RNTI, and does not comprise a random access-radio network temporary identity, RA-RNTI. transmitting, by a terminal, a first preamble to a base station, and receiving a first random access response, RAR, message transmitted by the base station; obtaining, by the terminal, an uplink transmission resource based on the first RAR message, and transmitting first uplink data on the uplink transmission resource, wherein a size of the uplink transmission resource supports the transmission of the first uplink data; and obtaining, by the terminal, a to-be-transmitted media access control protocol data, MAC PDU, from a multiplexing and assembly entity as the first uplink data, wherein the multiplexing and assembly entity is configured to package uplink data to be transmitted into the MAC PDU; wherein the step of transmitting the first uplink data on the uplink transmission resource comprises: checking a first buffer, by the terminal, whether data is stored therein, the first buffer being configured to store the MAC PDU in a msg3; and when the first buffer has data stored therein, obtaining data, by the terminal, from the first buffer; characterized in that when a size of the data in the first buffer is greater than the size of the uplink transmission resource, then: indicating, by a MAC layer entity of the terminal, a transmission failure of part or all of Radio Link Control protocol data units, RLC PDUs, comprised in the data in the first buffer to a Radio Link Control acknowledge mode, RLC AM, entity transmission side, wherein the RLC AM entity transmission side retransmits part or all of the RLC PDUs after receiving the indication; wherein when a downlink control channel that schedules the first RAR message is scrambled by a first radio network temporary identity, RNTI, and a random access, RA, process currently performed by the terminal is triggered by beam failure recovery, BFR, the terminal deletes the data in the first buffer; the first RNTI is selected from a plurality of RNTIs,, wherein the the plurality of RNTIs at least comprises a cell-radio network temporary identity, C-RNTI, and does not comprise a random access-radio network temporary identity, RA-RNTI. checking a first buffer, by the terminal, whether data is stored therein, the first buffer being configured to store the MAC PDU in a msg3; and when the first buffer has data stored therein, obtaining data, by the terminal, from the first buffer; characterized in that when a size of the data in the first buffer is greater than the size of the uplink transmission resource, then: indicating, by a MAC layer entity of the terminal, a transmission failure of part or all of Radio Link Control protocol data units, RLC PDUs, comprised in the data in the first buffer to a Radio Link Control acknowledge mode, RLC AM, entity transmission side, wherein the RLC AM entity transmission side retransmits part or all of the RLC PDUs after receiving the indication; wherein when a downlink control channel that schedules the first RAR message is scrambled by a first radio network temporary identity, RNTI, and a random access, RA, process currently performed by the terminal is triggered by beam failure recovery, BFR, the terminal deletes the data in the first buffer; the first RNTI is selected from a plurality of RNTIs,, wherein the the plurality of RNTIs at least comprises a cell-radio network temporary identity, C-RNTI, and does not comprise a random access-radio network temporary identity, RA-RNTI.