A method for automatically connecting a wireless network, the method being executed by an apparatus or a terminal device which pre-stores one or more wireless networks, wherein each pre-stored wireless network is associated with a wireless network and comprises a wireless network name, connection information and a wireless network list, wherein the connection information comprises a connection password corresponding to the wireless network, the method comprising: when a wireless network connection state of the apparatus or terminal device is disconnected and a first wireless network is detected by the apparatus or terminal device, generating a first wireless network list based on names of currently searched surrounding wireless networks; determining second wireless networks as all the pre-stored wireless networks that have the same name as the first wireless network; determining a second network list for each second wireless network as the wireless network list associated with the second wireless network in the pre-stored wireless networks; matching and comparing the first wireless network list with second wireless network lists to obtain matching and comparing results, wherein: for each second wireless network, the matching and comparing result is a proportion of the number of items between the first wireless network list, each of which has a same name as one of those in the associated second wireless network list, to a total number of items of the associated second wireless network list, and a result per second wireless network is obtained; in a case where any of the matching and comparing results is greater than a preset proportion, the apparatus or terminal device sending a connection request to the first wireless network based on the connection information of the pre-stored wireless network; wherein, the sending comprises: sorting the second wireless networks whose matching and comparing result is greater than the preset threshold based on the matching and comparing results in a large-to-small order, and sending (S305, S306) connection requests to the first wireless network by using the connection passwords associated with the sorted second wireless networks in the pre-stored wireless networks one by one according to the sorted order until connection succeeds or the connection passwords associated with the sorted second wireless networks in the pre-stored wireless networks have been used, wherein, the method further comprises: in case that for a connection request sent, connection succeeded, updating the pre-stored wireless networks based on the first wireless network list, wherein, the updating comprises: replacing the wireless network list of the pre-stored wireless network whose connection password has been used for successfully connecting to the first wireless network with the first wireless network list; in case that no matching and comparison result is greater than the preset proportion or for all connection requests sent, connection did not succeed, storing (S304, S308) the first wireless network list. when a wireless network connection state of the apparatus or terminal device is disconnected and a first wireless network is detected by the apparatus or terminal device, generating a first wireless network list based on names of currently searched surrounding wireless networks; determining second wireless networks as all the pre-stored wireless networks that have the same name as the first wireless network; determining a second network list for each second wireless network as the wireless network list associated with the second wireless network in the pre-stored wireless networks; matching and comparing the first wireless network list with second wireless network lists to obtain matching and comparing results, wherein: for each second wireless network, the matching and comparing result is a proportion of the number of items between the first wireless network list, each of which has a same name as one of those in the associated second wireless network list, to a total number of items of the associated second wireless network list, and a result per second wireless network is obtained; in a case where any of the matching and comparing results is greater than a preset proportion, the apparatus or terminal device sending a connection request to the first wireless network based on the connection information of the pre-stored wireless network; wherein, the sending comprises: sorting the second wireless networks whose matching and comparing result is greater than the preset threshold based on the matching and comparing results in a large-to-small order, and sending (S305, S306) connection requests to the first wireless network by using the connection passwords associated with the sorted second wireless networks in the pre-stored wireless networks one by one according to the sorted order until connection succeeds or the connection passwords associated with the sorted second wireless networks in the pre-stored wireless networks have been used, wherein, the method further comprises: in case that for a connection request sent, connection succeeded, updating the pre-stored wireless networks based on the first wireless network list, wherein, the updating comprises: replacing the wireless network list of the pre-stored wireless network whose connection password has been used for successfully connecting to the first wireless network with the first wireless network list; in case that no matching and comparison result is greater than the preset proportion or for all connection requests sent, connection did not succeed, storing (S304, S308) the first wireless network list.