First, the development documentation
https://mysqlclient.readthedocs.io
Second, the installation
pip install mysqlclient==1.3.12
Third, access to records
fetchone fetchmany fetchall
Fourth, simple example
Import MySQLdb Import pprint # create a connection object that represents a database connection connection = MySQLdb.connect ( Host = " 192.168.2.244 " , the User = " root " , passwd = " 123456 " , db = " crodigyrtu " , charset = " UTF8 " ) # returns a cursor object C = connection.cursor () # Call the cursor object look-up table method exeute c.execute ( " the SELECT * the FROM room_device " ) rows = c.fetchmany (c.rowcount) # c.rowcount return to get the number of rows pprint.pprint (rows) # call the cursor object exeute method for increasing the data c.execute ( " iNSERT INTO room_device ··········· " ) # must commit to the implementation of successful insertion Connection.commit () # call the cursor object exeute method to delete data c.execute ( " DELETE the FROM room_device ··········· " ) # must commit to the implementation of successful insertion connection.commit ()