Я записываю комнатную температуру, используя Raspberry Pi 3. Записанная температура должна быть отправлена в мою систему, и она должна быть сохранена в базе данных mysql. Но я не могу получить доступ к mysql удаленно.
Я предоставил все привилегии и прокомментировал слепой адрес
ОС: Ubuntu 18.04
Спасибо за помощь
def main():
while True:
temperature = sensor.get_temperature()
print("The temperature is %s celsius" % temperature)
time.sleep(1)
#Code to write the recorded temperature in the MYSQL
#database 'templog' and table 'temp-at-interrupt'
db = MySQLdb.connect(host="192.168.1.6", user="root",
passwd="root", db="templog")
cur = db.cursor()
print("connected to db")
The temperature is 30.625 celsius
Traceback (most recent call last):
File "temp-3.py", line 47, in <module>
main()
File "temp-3.py", line 25, in main
db = MySQLdb.connect(host="192.168.1.6", user="root", passwd="root", db="templog")
File "/usr/lib/python3/dist-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 204, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'192.168.1.7' (using password: YES)")