input: Write a python function to connect to a MySQL database, scrape data from a website, and insert it into the database.
  assert scrape_and_insert_data('https://www.example.com') == True
  assert scrape_and_insert_data('https://www.nonexistentwebsite.com') == False
output: def scrape_and_insert_data(url):
      import requests
      from bs4 import BeautifulSoup
      import mysql.connector
      from mysql.connector import Error
      
      # Function to connect to MySQL database
      def create_connection(host_name, user_name, user_password, db_name):
          connection = None
          try:
              connection = mysql.connector.connect(
                  host=host_name,
                  user=user_name,
                  passwd=user_password,
                  database=db_name
              )
          except Error as e:
              print(f"The error '{e}' occurred")
          return connection
      
      # Scraping function
      def scrape_website(url):
          try:
              response = requests.get(url)
              if response.status_code == 200:
                  soup = BeautifulSoup(response.content, 'html.parser')
                  # Example: Extracting all text from <p> tags
                  data = [p.text for p in soup.find_all('p')]
                  return data
              else:
                  return None
          except requests.exceptions.RequestException as e:
              print(f"Request error: {e}")
              return None
      
      # Insert data into database
      def insert_data(connection, data):
          cursor = connection.cursor()
          for item in data:
              # Example: Assuming there is a table named 'scraped_data' with a column 'content'
              query = "INSERT INTO scraped_data (content) VALUES (%s)"
              cursor.execute(query, (item,))
          connection.commit()
      
      # Scrape the website
      scraped_data = scrape_website(url)
      if scraped_data is None:
          return False
      
      # Connect to the database
      connection = create_connection("your_host", "your_username", "your_password", "your_database")
      if connection is None:
          return False
      
      # Insert the scraped data
      try:
          insert_data(connection, scraped_data)
          return True
      except Error as e:
          print(f"The error '{e}' occurred")
          return False
      finally:
          if connection is not None:
              connection.close()