2

db に接続できません。

ユーザー名とパスワードは正しいです。いくつかの組み合わせを試しました。SQLALCHEMY_DATABASE_URI使用を確認しまし'mysql://user:pass@localhost:8889/db-name'たが、接続できません。mysql コマンド ライン ユーティリティを使用して問題なく接続できます。パスワードなしでユーザー名を使用しようとしましたが、役に立ちませんでした。

Flask アプリの詳細 - config.py

import os
basedir = os.path.abspath(os.path.dirname(__file__))

CSRF_ENABLED = True

SQLALCHEMY_DATABASE_URI = 'mysql://datadmin:password@localhost:8889/db-name'
WHOOSH_BASE = os.path.join(basedir, 'whoosh')

_init_.py _ _

import os
from flask import Flask, render_template, jsonify, request
from flask.ext.sqlalchemy import SQLAlchemy
from config import basedir

app=Flask(__name__)
app.config.from_object('config')
db = SQLAlchemy(app)

from app import views, models

スタックトレース

File ".../site-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (OperationalError) (1045, "Access denied for user 'datadmin'@'localhost' (using password: YES)") None None

コマンドライン経由で接続する

user@hostname:~$ mysql -u datadmin -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.29 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

誰かが何かヒントを持っているか、何が間違っているかを理解する方法を知っていますか?

4

1 に答える 1