前提・実現したいこと
host=127.0.0.1を実行したい。
発生している問題・エラーメッセージ
hon3.9 /Users/SN/PycharmProjects/toudai/data.py Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/mysql/connector/network.py", line 607, in open_connection self.sock.connect(sockaddr) ConnectionRefusedError: [Errno 61] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/SN/PycharmProjects/toudai/data.py", line 3, in <module> conn = mysql.connector.connect(host='127.0.0.1') File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/mysql/connector/__init__.py", line 278, in connect return MySQLConnection(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/mysql/connector/connection.py", line 108, in __init__ self.connect(**kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/mysql/connector/abstracts.py", line 1003, in connect self._open_connection() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/mysql/connector/connection.py", line 351, in _open_connection self._socket.open_connection() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/mysql/connector/network.py", line 609, in open_connection raise errors.InterfaceError( mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on '127.0.0.1:3306' (61 Connection refused) Process finished with exit code 1
該当のソースコード
import mysql.connector conn = mysql.connector.connect(host='127.0.0.1')
試したこと
brew install mysql brew services start mysql mysql -u root パスと、名前は設定してないです。
調べたのでスが、応用版で、よくわからなかったです。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。