Python & MariaDB 연동하기

2021. 1. 24. 00:00컴퓨터언어/Python

728x90
반응형

1. brew install mariadb

2. pip install mariadb

3.

    try:
        conn = mariadb.connect(
            user="name",
            password="pw",
            host="domain_name",
            port=3306,
            database="schema_name"

        )
    except mariadb.Error as e:
        print(f"Error connecting to MariaDB Platform: {e}")
        sys.exit(1)
    cur = conn.cursor()
728x90
반응형