input: Write a python function to extract data from a MySQL database using a query string.
  assert extract_data_from_mysql("SELECT * FROM students") == [(1, 'John Doe', 'A'), (2, 'Jane Smith', 'B'), (3, 'Emily Johnson', 'A')]
  assert extract_data_from_mysql("SELECT name FROM students WHERE grade = 'A'") == [('John Doe',), ('Emily Johnson',)]
  assert extract_data_from_mysql("SELECT COUNT(*) FROM students") == [(3,)]
output: def extract_data_from_mysql(query):
      import mysql.connector
  
      # Establish the connection
      conn = mysql.connector.connect(
          host="localhost",
          user="yourusername",
          password="yourpassword",
          database="yourdatabase"
      )
  
      cursor = conn.cursor()
  
      # Execute the query
      cursor.execute(query)
  
      # Fetch all the rows
      result = cursor.fetchall()
  
      # Close the cursor and connection
      cursor.close()
      conn.close()
  
      return result