A random access method, comprising: determining, by a terminal device based on a predetermined rule, whether to cancel transmission of a first uplink channel on a first transmission occasion, the first uplink channel being a Physical Random Access Channel, PRACH, in a first message of a 2-step random access procedure, and the first transmission occasion being a transmission occasion corresponding to the PRACH, wherein the determining, by the terminal device based on the predetermined rule, whether to cancel the transmission of the first uplink channel on the first transmission occasion comprises: on a Time Division Duplex, TDD, single carrier, for a set of symbols in the first transmission occasion that are configured by a higher layer for transmission of the first uplink channel, if the terminal device detects a second Downlink Control Information, DCI, indicating to the terminal device to receive a downlink channel in a subset of symbols from the set of symbols, determining by the terminal device to cancel the transmission of the first uplink channel after a first time point, the first time point being a time point after a time length T from a last symbol of a control resource set where the second DCI is detected by the terminal device, wherein the time length T is time for channel processing; when the terminal device determines to cancel the transmission of the PRACH, cancelling the transmission of the PRACH and not transmitting a second uplink channel by the terminal device, the second uplink channel being a Physical Uplink Shared Channel, PUSCH, in the first message of the 2-step random access procedure; and when the terminal device determines not to transmit the PUSCH, not transmitting the PUSCH by the terminal device and transmitting or not transmitting the PRACH by the terminal device. determining, by a terminal device based on a predetermined rule, whether to cancel transmission of a first uplink channel on a first transmission occasion, the first uplink channel being a Physical Random Access Channel, PRACH, in a first message of a 2-step random access procedure, and the first transmission occasion being a transmission occasion corresponding to the PRACH, wherein the determining, by the terminal device based on the predetermined rule, whether to cancel the transmission of the first uplink channel on the first transmission occasion comprises: on a Time Division Duplex, TDD, single carrier, for a set of symbols in the first transmission occasion that are configured by a higher layer for transmission of the first uplink channel, if the terminal device detects a second Downlink Control Information, DCI, indicating to the terminal device to receive a downlink channel in a subset of symbols from the set of symbols, determining by the terminal device to cancel the transmission of the first uplink channel after a first time point, the first time point being a time point after a time length T from a last symbol of a control resource set where the second DCI is detected by the terminal device, wherein the time length T is time for channel processing; when the terminal device determines to cancel the transmission of the PRACH, cancelling the transmission of the PRACH and not transmitting a second uplink channel by the terminal device, the second uplink channel being a Physical Uplink Shared Channel, PUSCH, in the first message of the 2-step random access procedure; and when the terminal device determines not to transmit the PUSCH, not transmitting the PUSCH by the terminal device and transmitting or not transmitting the PRACH by the terminal device.