我已经按照https://github.com/worldveil/dejavu/blob/master/INSTALLATION.md的要求安装了所有依赖项

我正在使用Ubuntu 14.4,我是Linux的新手。

我安装了MYSQLDB并创建了一个名为“dejavu”的数据库。在终端中运行此命令时,出现以下错误。

> paul@paul-HP-Pavilion-dv6700-Notebook-PC:~/dejavu$ python dejavu.py
> --recognize mic 10 Traceback (most recent call last):   File "dejavu.py", line 64, in <module>
>     djv = init(config_file)   File "dejavu.py", line 31, in init
>     return Dejavu(config)   File "/home/paul/dejavu/dejavu/__init__.py", line 28, in __init__
>     self.db.setup()   File "/home/paul/dejavu/dejavu/database_sql.py", line 158, in setup
>     with self.cursor() as cur:   File "/home/paul/dejavu/dejavu/database_sql.py", line 322, in cursor
>     return Cursor(**options)   File "/home/paul/dejavu/dejavu/database_sql.py", line 345, in __init__
>     conn = mysql.connect(**options)   File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in
> Connect
>     return Connection(*args, **kwargs)   File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187,
> in __init__
>     super(Connection, self).__init__(*args, **kwargs2)
> _mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: NO)")

我猜想这与我将Dejavu链接或未链接到数据库的方式有关。

任何帮助将不胜感激。谢谢。

最佳答案

看起来您已经为MySQL数据库设置了密码,并且默认的dejavu配置未指定密码。

要运行示例,您需要使用MySQL数据库的设置更改dejavu.cnf.SAMPLE文件:

{
    "database": {
        "host": "127.0.0.1",
        "user": "root",
        "passwd": "<root_password>",
        "db": "dejavu"
    }
}

07-28 09:55