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. The function should use Flask for the web framework and MySQL for the database.
  assert implement_rest_api()
  assert implement_rest_api()
  assert implement_rest_api()
  assert implement_rest_api()
  assert implement_rest_api()
output: 
  def implement_rest_api():
      from flask import Flask, request, jsonify
      import mysql.connector
  
      app = Flask(__name__)
  
      def get_db_connection():
          return mysql.connector.connect(
              host="localhost",
              user="root",
              password="password",
              database="users_db"
          )
  
      @app.route('/users', methods=['POST'])
      def create_user():
          data = request.json
          name = data.get('name')
          email = data.get('email')
  
          conn = get_db_connection()
          cursor = conn.cursor()
          cursor.execute("INSERT INTO users (name, email) VALUES (%s, %s)", (name, email))
          conn.commit()
          cursor.close()
          conn.close()
  
          return jsonify({"message": "User created successfully"}), 201
  
      @app.route('/users', methods=['GET'])
      def read_all_users():
          conn = get_db_connection()
          cursor = conn.cursor(dictionary=True)
          cursor.execute("SELECT * FROM users")
          users = cursor.fetchall()
          cursor.close()
          conn.close()
  
          return jsonify(users), 200
  
      @app.route('/users/<int:user_id>', methods=['GET'])
      def read_single_user(user_id):
          conn = get_db_connection()
          cursor = conn.cursor(dictionary=True)
          cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
          user = cursor.fetchone()
          cursor.close()
          conn.close()
  
          if user:
              return jsonify(user), 200
          else:
              return jsonify({"message": "User not found"}), 404
  
      if __name__ == '__main__':
          app.run(debug=True)
  