数据库无法连接到我在 digitalocean 上的 discord 机器人 (discord.py)
database won't connect to my discord bot on digitalocean (discord.py)
我使用 digitalocean 并为我的 droplet 添加了数据库管理,并设置了所有可能的选项,但它无法连接...我尝试放置 sslmode="REQUIRED"
但它给了我另一个错误,它说我不应该把它......就像我让数据库连接到我的不和谐机器人一样? (水滴是ubuntu)
Traceback (most recent call last):
File "/home/peppe/.venvs/discord/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 232, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Can't connect to MySQL server on 'discordbotdatabase....com:3306' (4)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "LMIIBotDevelopment.py", line 29, in <module>
lmiibot_db = mysql.connector.connect(
File "/home/peppe/.venvs/discord/lib/python3.8/site-packages/mysql/connector/__init__.py", line 272, in connect
return CMySQLConnection(*args, **kwargs)
File "/home/peppe/.venvs/discord/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 85, in __init__
self.connect(**kwargs)
File "/home/peppe/.venvs/discord/lib/python3.8/site-packages/mysql/connector/abstracts.py", line 1003, in connect
self._open_connection()
File "/home/peppe/.venvs/discord/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 232, in _open_connection
self._cmysql.connect(**cnx_kwargs)
KeyboardInterrupt
import mysql.connector
lmiibot_db = mysql.connector.connect(
host="discordbotdatabase....com",
user="doadmin",
passwd="password",
database="lmiibot",
auth_plugin="mysql_native_password",
)
已解决。我忘了添加服务器端口
import mysql.connector
lmiibot_db = mysql.connector.connect(
host="discordbotdatabase....com",
port="port"
user="doadmin",
passwd="password",
database="lmiibot",
auth_plugin="mysql_native_password",
)
我使用 digitalocean 并为我的 droplet 添加了数据库管理,并设置了所有可能的选项,但它无法连接...我尝试放置 sslmode="REQUIRED"
但它给了我另一个错误,它说我不应该把它......就像我让数据库连接到我的不和谐机器人一样? (水滴是ubuntu)
Traceback (most recent call last):
File "/home/peppe/.venvs/discord/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 232, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Can't connect to MySQL server on 'discordbotdatabase....com:3306' (4)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "LMIIBotDevelopment.py", line 29, in <module>
lmiibot_db = mysql.connector.connect(
File "/home/peppe/.venvs/discord/lib/python3.8/site-packages/mysql/connector/__init__.py", line 272, in connect
return CMySQLConnection(*args, **kwargs)
File "/home/peppe/.venvs/discord/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 85, in __init__
self.connect(**kwargs)
File "/home/peppe/.venvs/discord/lib/python3.8/site-packages/mysql/connector/abstracts.py", line 1003, in connect
self._open_connection()
File "/home/peppe/.venvs/discord/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 232, in _open_connection
self._cmysql.connect(**cnx_kwargs)
KeyboardInterrupt
import mysql.connector
lmiibot_db = mysql.connector.connect(
host="discordbotdatabase....com",
user="doadmin",
passwd="password",
database="lmiibot",
auth_plugin="mysql_native_password",
)
已解决。我忘了添加服务器端口
import mysql.connector
lmiibot_db = mysql.connector.connect(
host="discordbotdatabase....com",
port="port"
user="doadmin",
passwd="password",
database="lmiibot",
auth_plugin="mysql_native_password",
)