Accessing MySQL from Python 3: Access denied for user

前端 未结 8 1733
鱼传尺愫
鱼传尺愫 2021-01-12 05:16

I tried to access MySQL from Python 3.3 with the following methods:

import mysql.connector

config = {
  \'user\': \'###\',
  \'password\': \'******\',
  \'h         


        
8条回答
  •  感动是毒
    2021-01-12 05:49

    I was getting this error because I had quotes in my config file.

    [mysql]
    username: 'uuuu'
    password: 'pppp'
    host: 'localhost'
    database: 'ffffdd'
    

    gave me the error. However, removing the quotes worked:

    [mysql]
    username: uuuu
    password: pppp
    host: localhost
    database: ffffdd
    

提交回复
热议问题