pymysql.err.OperationalError:(1045,“用户'ziasha0''@'101.50.91.203'的访问被拒绝(使用密码:是”)

时间:2019-10-01 18:02:32

标签: python raspberry-pi3 iot

我正在使用freehostia.com,但是我想将我的Raspberry Pi与freehostia(已过期)连接起来,所以我的1年免费试用期已过。 我的项目是物联网基础项目。

代码

import pymysql
import Rpi.GPIO as GPIO
import time
a=[]
a2=[]
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(12,GPIO.OUT)
GPIO.setup(16,GPIO.OUT)
GPIO.setup(20,GPIO.OUT)
GPIO.setup(21,GPIO.OUT)


db=pymysql.connect('mysql.freehostia.com','ziasha0','balebalebale1.X','ziasha0_104')
cursor=db.cursor()
sql="SELECT * FROM new_light_table"
cursor.execute(sql)
results=cursor.fetchall()
for row in results:
     a.append(row[2])
r1=a[0]
r2=a[1]
r3=a[2]
r4=a[3]
if r1 == 1:
   GPIO.output(12,0)
if r1 == 0:
   GPIO.output(12,1)
if r2 == 1:
   GPIO.output(16,0)
if r2 == 0:
   GPIO.output(16,1)
if r3 == 1:
   GPIO.output(20,0)
if r3 == 0:
   GPIO.output(20,1)
if r4 == 1:
   GPIO.output(21,0)
if r4 == 0:
   GPIO.output(21,1)
print(r1)
print(r2)
print(r3)
print(r4)
db.commit()
db.close()
time.sleep(4) 

[![在此处输入图片描述] [1]] [1]

错误:

File "/home/pi/Desktop/python.py", line 14, in <module>
    db=pymysql.connect('mysql.freehostia.com','ziasha0','balebalebale1.X','ziasha0_104')
  File "/home/pi/.local/lib/python3.7/site-packages/pymysql/__init__.py", line 94, in Connect
    return Connection(*args, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/pymysql/connections.py", line 325, in _init_
    self.connect()
  File "/home/pi/.local/lib/python3.7/site-packages/pymysql/connections.py", line 599, in connect
    self._request_authentication()
  File "/home/pi/.local/lib/python3.7/site-packages/pymysql/connections.py", line 861, in _request_authentication
    auth_packet = self._read_packet()
  File "/home/pi/.local/lib/python3.7/site-packages/pymysql/connections.py", line 684, in _read_packet
    packet.check_error()
  File "/home/pi/.local/lib/python3.7/site-packages/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/home/pi/.local/lib/python3.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, "Access denied for user 'ziasha0'@'101.50.95.146' (using password: YES)")


  [1]: https://i.stack.imgur.com/wyZCA.jpg

现在我想问我这个错误是由于我的freehostia过期了引起的吗?

0 个答案:

没有答案