title: Flask SQLAlchemy Operational Error Access Denied for User
body: <p>Can't connect to db. </p>
  
  <p>Username and password is correct. I've tried several combinations. I've verified my <code>SQLALCHEMY_DATABASE_URI</code> using <code>'mysql://user:pass@localhost:8889/db-name'</code> but cannot connect. I can connect without issue using mysql command line utility. I've even tried using a username without a password to no avail.</p>
  
  <p><strong>Flask App Details - config.py</strong></p>
  
  <pre><code>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')
  </code></pre>
  
  <p><strong>_<em>init</em>_.py</strong></p>
  
  <pre><code>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
  </code></pre>
  
  <p><strong>Stacktrace</strong></p>
  
  <pre><code>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
  </code></pre>
  
  <p><strong>Connecting via Command Line</strong></p>
  
  <pre><code>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&gt;
  </code></pre>
  
  <p>Anybody have any tips or know how I can figure out what's wrong?</p>