C:\Users\ersan\Desktop>python 2.py
Traceback (most recent call last):
File "C:\Users\ersan\Desktop\2.py", line 14, in <module>
for result in cursor.execute(script, multi=True):
File "C:\Users\ersan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mysql\connector\cursor.py", line 486, in _execute_iter
result = next(query_iter)
^^^^^^^^^^^^^^^^
File "C:\Users\ersan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mysql\connector\connection.py", line 522, in cmd_query_iter
yield self._handle_result(self._send_cmd(ServerCmd.QUERY, statements))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ersan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mysql\connector\connection.py", line 395, in _handle_result
raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1050 (42S01): Table 'hello' already exists
Cause: MySQL connector failed to handle the result.
Solution: Install the PIP mysql.connector program in the database.
C:\Users\ersan\Desktop>pip install mysql-connector-python
Collecting mysql-connector-python
Downloading mysql_connector_python-8.0.33-cp311-cp311-win_amd64.whl (9.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.6/9.6 MB 3.5 MB/s eta 0:00:00
Collecting protobuf<=3.20.3,>=3.11.0 (from mysql-connector-python)
Downloading protobuf-3.20.3-py2.py3-none-any.whl (162 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.1/162.1 kB 3.2 MB/s eta 0:00:00
Installing collected packages: protobuf, mysql-connector-python
Successfully installed mysql-connector-python-8.0.33 protobuf-3.20.3
--Execute again will fixed the issue
C:\Users\ersan\Desktop>python 2.py
Number of rows affected by statement 'create table IF NOT EXISTS hello (id int)': 0
Number of rows affected by statement 'create table IF NOT EXISTS hello1(id int)': 0