To create a Python script that connects to a MySQL database and performs CRUD operations, you can use the `mysql-connector-python` library. First, install it using pip:

```bash
pip install mysql-connector-python
```

Next, create a file named `crud_operations.py` and add the following code:

```python
import argparse
import mysql.connector
from mysql.connector import Error

def connect_to_database(host, port, user, password, db_name):
    try:
        connection = mysql.connector.connect(
            host=host,
            port=port,
            user=user,
            password=password,
            database=db_name
        )
        if connection.is_connected():
            print("Successfully connected to the database")
            return connection
    except Error as e:
        print(f"Error: {e}")
        return None


def close_connection(connection):
    if connection is not None and connection.is_connected():
        connection.close()
        print("Connection closed")


def create_table(connection):
    cursor = connection.cursor()
    table_query = """
    CREATE TABLE IF NOT EXISTS employees (
        id INT AUTO_INCREMENT PRIMARY KEY,
        first_name VARCHAR(50) NOT NULL,
        last_name VARCHAR(50) NOT NULL,
        department VARCHAR(100),
        salary DECIMAL(10, 2)
    )
    """
    cursor.execute(table_query)
    connection.commit()
    print("Employees table created successfully")


def insert_employee(connection, first_name, last_name, department, salary):
    cursor = connection.cursor()
    insert_query = f"""
    INSERT INTO employees (first_name, last_name, department, salary)
    VALUES ('{first_name}', '{last_name}', '{department}', {salary})
    """
    cursor.execute(insert_query)
    connection.commit()
    print(f"Employee {first_name} {last_name} inserted successfully")


def update_employee(connection, employee_id, first_name, last_name, department, salary):
    cursor = connection.cursor()
    update_query = f"""
    UPDATE employees
    SET first_name='{first_name}', last_name='{last_name}', department='{department}', salary={salary}
    WHERE id={employee_id}
    """
    cursor.execute(update_query)
    connection.commit()
    print(f"Employee with ID {employee_id} updated successfully")


def delete_employee(connection, employee_id):
    cursor = connection.cursor()
    delete_query = f"DELETE FROM employees WHERE id={employee_id}"
    cursor.execute(delete_query)
    connection.commit()
    print(f"Employee with ID {employee_id} deleted successfully")


def get_all_employees(connection):
    cursor = connection.cursor()
    select_query = "SELECT * FROM employees"
    cursor.execute(select_query)
    rows = cursor.fetchall()

    for row in rows:
        print(row)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Perform CRUD operations on a MySQL database")
    parser.add_argument("--host", required=True, help="Database host")
    parser.add_argument("--port", required=True, type=int, help="Database port")
    parser.add_argument("--user", required=True, help="Database user")
    parser.add_argument("--password", required=True, help="Database password")
    parser.add_argument("--db_name", required=True, help="Database name")

    args = parser.parse_args()

    connection = connect_to_database(args.host, args.port, args.user, args.password, args.db_name)

    if connection is not None:
        create_table(connection)

        # Insert example employees
        insert_employee(connection, "John", "Doe", "IT", 50000)
        insert_employee(connection, "Jane", "Smith", "HR", 55000)

        # Update an employee's information
        update_employee(connection, 1, "John", "Doe", "IT", 60000)

        # Delete an employee
        delete_employee(connection, 2)

        # Get all employees
        get_all_employees(connection)

        close_connection(connection)
```

You can run the script using the following command:

```bash
python crud_operations.py --host localhost --port 3306 --user root --password your_password --db_name your_database_name
```

Replace `localhost`, `3306`, `root`, `your_password`, and `your_database_name` with your actual database connection details.
MySQL 데이터베이스에 연결하고 CRUD 작업을 수행하는 Python 스크립트를 만들려면 `mysql-connector-python` 라이브러리를 사용할 수 있습니다. 먼저 pip를 사용하여 설치합니다:

```bash
pip install mysql-connector-python
```

그런 다음 `crud_operations.py`라는 파일을 만들고 다음 코드를 추가합니다:

```python
import argparse
import mysql.connector
from mysql.connector import Error

def connect_to_database(host, port, user, password, db_name):
    try:
        connection = mysql.connector.connect(
            host=host,
            port=port,
            user=user,
            password=password,
            database=db_name
        )
        if connection.is_connected():
            print("Successfully connected to the database")
            return connection
    except Error as e:
        print(f"Error: {e}")
        return None


def close_connection(connection):
    if connection is not None and connection.is_connected():
        connection.close()
        print("Connection closed")


def create_table(connection):
    cursor = connection.cursor()
    table_query = """
    CREATE TABLE IF NOT EXISTS employees (
        id INT AUTO_INCREMENT PRIMARY KEY,
        first_name VARCHAR(50) NOT NULL,
        last_name VARCHAR(50) NOT NULL,
        department VARCHAR(100),
        salary DECIMAL(10, 2)
    )
    """
    cursor.execute(table_query)
    connection.commit()
    print("Employees table created successfully")


def insert_employee(connection, first_name, last_name, department, salary):
    cursor = connection.cursor()
    insert_query = f"""
    INSERT INTO employees (first_name, last_name, department, salary)
    VALUES ('{first_name}', '{last_name}', '{department}', {salary})
    """
    cursor.execute(insert_query)
    connection.commit()
    print(f"Employee {first_name} {last_name} inserted successfully")


def update_employee(connection, employee_id, first_name, last_name, department, salary):
    cursor = connection.cursor()
    update_query = f"""
    UPDATE employees
    SET first_name='{first_name}', last_name='{last_name}', department='{department}', salary={salary}
    WHERE id={employee_id}
    """
    cursor.execute(update_query)
    connection.commit()
    print(f"Employee with ID {employee_id} updated successfully")


def delete_employee(connection, employee_id):
    cursor = connection.cursor()
    delete_query = f"DELETE FROM employees WHERE id={employee_id}"
    cursor.execute(delete_query)
    connection.commit()
    print(f"Employee with ID {employee_id} deleted successfully")


def get_all_employees(connection):
    cursor = connection.cursor()
    select_query = "SELECT * FROM employees"
    cursor.execute(select_query)
    rows = cursor.fetchall()

    for row in rows:
        print(row)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Perform CRUD operations on a MySQL database")
    parser.add_argument("--host", required=True, help="Database host")
    parser.add_argument("--port", required=True, type=int, help="Database port")
    parser.add_argument("--user", required=True, help="Database user")
    parser.add_argument("--password", required=True, help="Database password")
    parser.add_argument("--db_name", required=True, help="Database name")

    args = parser.parse_args()

    connection = connect_to_database(args.host, args.port, args.user, args.password, args.db_name)

    if connection is not None:
        create_table(connection)

        # Insert example employees
        insert_employee(connection, "John", "Doe", "IT", 50000)
        insert_employee(connection, "Jane", "Smith", "HR", 55000)

        # Update an employee's information
        update_employee(connection, 1, "John", "Doe", "IT", 60000)

        # Delete an employee
        delete_employee(connection, 2)

        # Get all employees
        get_all_employees(connection)

        close_connection(connection)
```

다음 명령을 사용하여 스크립트를 실행할 수 있습니다:

```bash
python crud_operations.py --host localhost --port 3306 --user root --password your_password --db_name your_database_name
```

`localhost`, `3306`, `root`, `귀하의 비밀번호`, `귀하의 데이터베이스 이름`을 실제 데이터베이스 연결 세부 정보로 바꿉니다.