title: Write DataFrame to mysql table using pySpark
body: <p>I am attempting to insert records into a <code>MySql</code> table. The table contains <code>id</code> and <code>name</code> as columns.</p>
  
  <p>I am doing like below in a <code>pyspark</code> shell.</p>
  
  <pre><code>name = 'tester_1'
  id = '103'  
  import pandas as pd
  l = [id,name]
  
  df = pd.DataFrame([l])
  
  df.write.format('jdbc').options(
        url='jdbc:mysql://localhost/database_name',
        driver='com.mysql.jdbc.Driver',
        dbtable='DestinationTableName',
        user='your_user_name',
        password='your_password').mode('append').save()
  </code></pre>
  
  <p>I am getting the below attribute error</p>
  
  <p><code>AttributeError: 'DataFrame' object has no attribute 'write'</code></p>
  
  <p>What am I doing wrong? What is the correct method to insert records into a <code>MySql</code> table from <code>pySpark</code></p>