Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save khanh96le/16b73045013a2000b5528b1e3bc4529a to your computer and use it in GitHub Desktop.
Save khanh96le/16b73045013a2000b5528b1e3bc4529a to your computer and use it in GitHub Desktop.
Permission denied when migrating database to Mysql - FlaskMigrate

Error Logs

(env) ➜  platform_api git:(develop) python manage.py db upgrade
/Users/jerryle/Projects/gotit/platform_api/main/__init__.py:50: SyntaxWarning: import * only allowed at module level
  def _register_subpackages():
Traceback (most recent call last):
  File "manage.py", line 40, in <module>
    manager.run()
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/flask_script/__init__.py", line 412, in run
    result = self.handle(sys.argv[0], sys.argv[1:])
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/flask_script/__init__.py", line 383, in handle
    res = handle(*args, **config)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/flask_script/commands.py", line 216, in __call__
    return self.run(*args, **kwargs)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/flask_migrate/__init__.py", line 235, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/alembic/command.py", line 254, in upgrade
    script.run_env()
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/alembic/script/base.py", line 427, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file
    module = load_module_py(module_id, path)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/alembic/util/compat.py", line 141, in load_module_py
    mod = imp.load_source(module_id, path, fp)
  File "migrations/env.py", line 104, in <module>
    run_migrations_online()
  File "migrations/env.py", line 86, in run_migrations_online
    connection = engine.connect()
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2018, in connect
    return self._connection_cls(self, **kwargs)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 72, in __init__
    if connection is not None else engine.raw_connection()
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2104, in raw_connection
    self.pool.unique_connection, _connection)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2078, in _wrap_pool_connect
    e, dialect, self)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1405, in _handle_dbapi_exception_noconnection
    exc_info
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2074, in _wrap_pool_connect
    return fn()
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/pool.py", line 318, in unique_connection
    return _ConnectionFairy._checkout(self)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/pool.py", line 713, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/pool.py", line 480, in checkout
    rec = pool._do_get()
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/pool.py", line 1151, in _do_get
    return self._create_connection()
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/pool.py", line 323, in _create_connection
    return _ConnectionRecord(self)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/pool.py", line 449, in __init__
    self.connection = self.__connect()
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/pool.py", line 607, in __connect
    connection = self.__pool._invoke_creator(self)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 97, in connect
    return dialect.connect(*cargs, **cparams)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 385, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/Users/jerryle/Projects/gotit/platform_api/env/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1045, "Access denied for user 'root'@'localhost' (using password: YES)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment