input: Write a python function to migrate a MySQL database from one host to another using the given `migrate_database` function.
  assert migrate_database('localhost', 'user1', 'pass1', 'remotehost', 'user2', 'pass2')==None
  assert migrate_database('127.0.0.1', 'admin1', 'adminpass1', '192.168.0.2', 'admin2', 'adminpass2')==None
output: def migrate_database(source_host, source_user, source_pass, target_host, target_user, target_pass):
      import MySQLdb
      import os
  
      # Connect to the source database
      source_db = MySQLdb.connect(host=source_host, user=source_user, passwd=source_pass)
      source_cursor = source_db.cursor()
      source_cursor.execute("SHOW DATABASES;")
      databases = source_cursor.fetchall()
  
      for database in databases:
          db_name = database[0]
          if db_name in ('information_schema', 'performance_schema', 'mysql', 'sys'):
              continue
  
          # Dump the source database
          dump_cmd = f"mysqldump -h {source_host} -u {source_user} -p{source_pass} {db_name} > {db_name}.sql"
          os.system(dump_cmd)
  
          # Create the database on the target host
          target_db = MySQLdb.connect(host=target_host, user=target_user, passwd=target_pass)
          target_cursor = target_db.cursor()
          target_cursor.execute(f"CREATE DATABASE IF NOT EXISTS {db_name};")
  
          # Restore the database to the target host
          restore_cmd = f"mysql -h {target_host} -u {target_user} -p{target_pass} {db_name} < {db_name}.sql"
          os.system(restore_cmd)
  
          # Clean up the dump file
          os.remove(f"{db_name}.sql")
  
      # Close connections
      source_cursor.close()
      source_db.close()
      target_cursor.close()
      target_db.close()