2017-07-18 71 views
0

我試圖用django來測試程序& mysql在travis-ci ,但會引發這個錯誤。帶有mysql和django的Travis CI返回(1045,「拒絕用戶root'@'localhost'(使用密碼:YES)」)

pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)") 

我.travis.yml是

language: python 

python: 
    - '3.6' 

services: 
    - mysql 

matrix: 
    include: 
    - os: osx 
     language: generic 
     sudo: required 

env: 
    - DJANGO=1.11 DB=mysql 

before_install: 
    - brew update  
    - brew install python3 
    - virtualenv env -p python3 
    - source env/bin/activate 
    - brew install mysql 

install: 
    - pip install -r requirements.txt 

before_script: 
    - mysql.server start 

script: 
    - cd <my_django_project> 
    - python manage.py test 

在測試中,效果還不錯,直到$cd <my_django_project>,並返回The command "cd <my_django_project>" exited with 0.

$python manage.py test引發的錯誤

pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)") 

而且,當使用我的本地終端時,$python manage.py test不會產生錯誤並正常通過測試。

我擡頭看看the existing question,但是這個信息可能是舊的。

我該怎麼辦?

謝謝。

+0

看看這個回答你的問題:https://stackoverflow.com/questions/17975120/access-denied-for-user-rootlocalhost-using-password-yes-no -privileges –

+0

*此信息可能是舊的*。或者可能不是。你讀過它並嘗試它的建議?你做了什麼事?那些包含相同錯誤信息的幾十個其他問題呢?你讀過他們了嗎? –

回答

0

是否是根數據庫來賓用戶?

如果是,從你的數據庫管理員用戶,授予根訪問MySQL環境表 'mysql.user' 如下:

GRANT SELECT ON mysqluser TO'root'@'%';

對我來說它的工作, 伊萬

相關問題