input: Write a Python function to insert a new user into a MySQL database and retrieve all users.
  assert insert_user_and_get_all('Alice', 'alice@example.com') == [{'id': 1, 'name': 'Alice', 'email': 'alice@example.com'}]
  assert insert_user_and_get_all('Bob', 'bob@example.com') == [{'id': 1, 'name': 'Alice', 'email': 'alice@example.com'}, {'id': 2, 'name': 'Bob', 'email': 'bob@example.com'}]
  assert insert_user_and_get_all('Charlie', 'charlie@example.com') == [{'id': 1, 'name': 'Alice', 'email': 'alice@example.com'}, {'id': 2, 'name': 'Bob', 'email': 'bob@example.com'}, {'id': 3, 'name': 'Charlie', 'email': 'charlie@example.com'}]
output: def insert_user_and_get_all(name, email):
      import mysql.connector
  
      # Establish the connection to the database
      conn = mysql.connector.connect(
          host='localhost',
          user='yourusername',
          password='yourpassword',
          database='yourdatabase'
      )
  
      cursor = conn.cursor()
  
      # Insert the new user
      insert_query = "INSERT INTO users (name, email) VALUES (%s, %s)"
      cursor.execute(insert_query, (name, email))
      conn.commit()
  
      # Retrieve all users
      select_query = "SELECT * FROM users"
      cursor.execute(select_query)
      rows = cursor.fetchall()
  
      # Close the connection
      cursor.close()
      conn.close()
  
      # Format the result as a list of dictionaries
      result = [{'id': row[0], 'name': row[1], 'email': row[2]} for row in rows]
      return result