类如含有@之类的特殊符号,在链接数据库时,需要提前url转码,不然会报密码错误. python3/2分别引用是同样的第三方库,但是引用方式不同 python2 from urllib import quote_plus as urlquote password = urlquote('password') db_data = pymysql.connect(host='127.0.0.1',user='root'.password = password,db = 'test',port=3306