使用pymysql将MySQL服务器窗口与Python连接时出错

时间:2018-06-22 17:37:35

标签: mysql windows pymysql

到目前为止,我一直在Ubuntu上创建该应用程序。服务器工作正常。但是现在,我将其移至Windows并创建了服务器并完成了所有工作。但我说yAxis: { min: 0.25, max: 0.75, startOnTick: false, // optional endOnTick: false, // optional // ... } 时遇到错误。这是完整的错误。

Access denied for user 'root@localhost' (using password: NO)

这是我的代码块。

Traceback (most recent call last):
  File "D:/Research/sinhala-spellchecker/tokenize_words.py", line 15, in <module>
    db = pymysql.connect(HostName,HostUser,HostPass,DatabaseName, charset='utf8')
  File "C:\Users\Pankaja\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "C:\Users\Pankaja\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\connections.py", line 704, in __init__
    self.connect()
  File "C:\Users\Pankaja\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\connections.py", line 974, in connect
    self._request_authentication()
  File "C:\Users\Pankaja\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\connections.py", line 1203, in _request_authentication
    auth_packet = self._read_packet()
  File "C:\Users\Pankaja\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\connections.py", line 1059, in _read_packet
    packet.check_error()
  File "C:\Users\Pankaja\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\connections.py", line 384, in check_error
    err.raise_mysql_exception(self._data)
  File "C:\Users\Pankaja\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: NO)")

它是另一种语言。因此,不要介意sinhala_text。为什么会出现此错误?我在MySQL工作台中连接并测试了数据库。与配置的主机名和hostpassword,然后它连接。但我无法将其与python中的pymysql连接。如何解决呢?

0 个答案:

没有答案