input: Write a function to implement a REST API in Python for creating and reading users. The API should have endpoints for creating a user, reading all users, and reading a single user. Attach the necessary MySQL configuration and utilize Flask for handling the routes.
  assert implement_rest_api() is not None
output: 
  def implement_rest_api():
      from flask import Flask, request, jsonify
      import mysql.connector
  
      app = Flask(__name__)
  
      # MySQL configuration
      db = mysql.connector.connect(
          host="localhost",
          user="yourusername",
          password="yourpassword",
          database="yourdatabase"
      )
      cursor = db.cursor()
  
      @app.route('/users', methods=['POST'])
      def create_user():
          data = request.json
          username = data['username']
          email = data['email']
          cursor.execute("INSERT INTO users (username, email) VALUES (%s, %s)", (username, email))
          db.commit()
          return jsonify({"message": "User created successfully"}), 201
  
      @app.route('/users', methods=['GET'])
      def get_all_users():
          cursor.execute("SELECT * FROM users")
          users = cursor.fetchall()
          user_list = [{'id': user[0], 'username': user[1], 'email': user[2]} for user in users]
          return jsonify(user_list), 200
  
      @app.route('/users/<int:user_id>', methods=['GET'])
      def get_single_user(user_id):
          cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
          user = cursor.fetchone()
          if user:
              return jsonify({'id': user[0], 'username': user[1], 'email': user[2]}), 200
          else:
              return jsonify({"message": "User not found"}), 404
  
      return app
  