Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL snapshot didn't work. #10

Closed
epicserve opened this issue Aug 22, 2014 · 5 comments
Closed

MySQL snapshot didn't work. #10

epicserve opened this issue Aug 22, 2014 · 5 comments

Comments

@epicserve
Copy link

I've anonymized settings bellow.

Here is my stellar.yaml file.

project_name: 'my_db_name'
tracked_databases: ['my_db_name']
url: 'mysql+pymysql://my_db_username:******************@localhost/'
stellar_url: 'mysql+pymysql://my_db_username:******************@localhost/stellar_data'

Here is my command line session.

(my-project) ❯ stellar init
Please enter the url for your database.

For example:
PostreSQL: postgresql://localhost:5432/
MySQL: mysql+pymysql://root@localhost/: mysql+pymysql://my_db_username:******************@localhost/
You have the following databases: information_schema, my_db_name, test, test_my_db_name
Please enter the name of the database (eg. projectdb): my_db_name
Please enter your project name (used internally, eg. my_db_name) [my_db_name]:
Wrote stellar.yaml

Warning: MySQL support is still in beta.
Tip: You probably want to take a snapshot: stellar snapshot
(my-project)
brento@my-host ~/Sites/my-project-django (responses!)
(my-project-django) ❯ stellar snapshot
Traceback (most recent call last):
  File "/Users/brento/.virtualenvs/my-project/bin/stellar", line 9, in <module>
    load_entry_point('stellar==0.3.1', 'console_scripts', 'stellar')()
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/stellar/command.py", line 225, in main
    stellar()
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/click/core.py", line 572, in __call__
    return self.main(*args, **kwargs)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/click/core.py", line 552, in main
    rv = self.invoke(ctx)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/click/core.py", line 893, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/click/core.py", line 744, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/click/core.py", line 388, in invoke
    return callback(*args, **kwargs)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/stellar/command.py", line 42, in snapshot
    app = Stellar()
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/stellar/app.py", line 43, in __init__
    self.init_database()
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/stellar/app.py", line 61, in init_database
    tables_missing = self.create_stellar_database()
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/stellar/app.py", line 70, in create_stellar_database
    self.operations.create_database('stellar_data')
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/stellar/operations.py", line 31, in create_database
    '%s%s' % (raw_conn.engine.url, database)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/sqlalchemy_utils/functions/database.py", line 215, in create_database
    engine.execute(text)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1752, in execute
    return connection.execute(statement, *multiparams, **params)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 721, in execute
    return self._execute_text(object, multiparams, params)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 870, in _execute_text
    statement, parameters
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context
    context)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1160, in _handle_dbapi_exception
    exc_info
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context
    context)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 436, in do_execute
    cursor.execute(statement, parameters)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/pymysql/cursors.py", line 132, in execute
    result = self._query(query)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/pymysql/cursors.py", line 271, in _query
    conn.query(q)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/pymysql/connections.py", line 726, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/pymysql/connections.py", line 861, in _read_query_result
    result.read()
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/pymysql/connections.py", line 1064, in read
    first_packet = self.connection._read_packet()
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/pymysql/connections.py", line 826, in _read_packet
    packet.check_error()
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/pymysql/connections.py", line 370, in check_error
    raise_mysql_exception(self._data)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/pymysql/err.py", line 116, in raise_mysql_exception
    _check_mysql_exception(errinfo)
  File "/Users/brento/.virtualenvs/my-project/lib/python2.7/site-packages/pymysql/err.py", line 109, in _check_mysql_exception
    raise errorclass(errno,errorvalue)
sqlalchemy.exc.OperationalError: (OperationalError) (1044, u"Access denied for user 'my_db_username'@'localhost' to database 'stellar_data'") "CREATE DATABASE stellar_data CHARACTER SET = 'utf8'" ()
@phaer
Copy link

phaer commented Aug 22, 2014

sqlalchemy.exc.OperationalError: (OperationalError) (1044, u"Access denied for user 'my_db_username'@'localhost' to database 'stellar_data'") "CREATE DATABASE stellar_data CHARACTER SET = 'utf8'" ()

Are you sure your user has the right privileges to create a new databse? Something like

GRANT CREATE ON stellar_data TO 'my_db_username'@'localhost';

should help.

@epicserve
Copy link
Author

I gave the user all global privilages and now I'm getting.

sqlalchemy.exc.ProgrammingError: (ProgrammingError) (1146, u"Table 'stellar_data.snapshot' doesn't exist") 'SELECT count(*) AS count_1 \nFROM (SELECT snapshot.id AS snapshot_id, snapshot.snapshot_name AS snapshot_snapshot_name, snapshot.project_name AS snapshot_project_name, snapshot.hash AS snapshot_hash, snapshot.created_at AS snapshot_created_at, snapshot.worker_pid AS snapshot_worker_pid \nFROM snapshot \nWHERE snapshot.snapshot_name = %s AND snapshot.project_name = %s) AS anon_1' ('snap1', 'my_db_name')

@kevinjqiu
Copy link

You may want to drop stellar_data and re initialize.

@epicserve
Copy link
Author

That worked. It might be helpful to include what permissions are needed to the readme. Also it might help to know how to add password. I had to do some Google to find the syntax.

@Teemu
Copy link
Contributor

Teemu commented Oct 9, 2014

This was added to the README.

@Teemu Teemu closed this as completed Oct 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants