How can I migrate mysql to remote server

Try

redis-cli -p 11311 flushall
bench restore /path/to/sqlfile

Try,

redis-cli -p 11311 flushall



It worked! Thanks so much for your help

One last question - is there any way I get get the syntax for bench
commands? bench --help only gives me a list of commands, with no examples
Ex. I wanted to migrate the other sites, so I tried various combinations
like bench migrate sitename, bench migrate --site sitename etc.
None of them worked

bench --site all migrate

You can
bench {{command}} --help

When I do that I get this problem again:

ubuntu@ubuntu-amd64:~$ bench --site all migrate
Migrating fbademo
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File
“/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line
77, in
main()
File
“/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line
14, in main
click.Group(commands=commands)(prog_name=‘bench’)
File
“/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”,
line 664, in call
return self.main(*args, **kwargs)
File
“/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”,
line 644, in main
rv = self.invoke(ctx)
File
“/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”,
line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File
“/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”,
line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File
“/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”,
line 837, in invoke
return ctx.invoke(self.callback, **ctx.params)
File
“/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”,
line 464, in invoke
return callback(*args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/commands.py”, line 28,
in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/commands.py”, line
205, in migrate
frappe.modules.patch_handler.run_all()
File
“/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”,
line 23, in run_all
for patch in get_all_patches():
File
“/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”,
line 37, in get_all_patches
patches.extend(frappe.get_file_items(frappe.get_pymodule_path(app,
“patches.txt”)))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line
601, in get_pymodule_path
return
os.path.join(os.path.dirname(get_module(scrub(modulename)).file),
*joins)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line
564, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
ImportError: No module named frappe_subscription

If its a big problem, I’ll just use one site. But I can’t seem to find a
command to delete the other sites.

There is a bench drop-site but be very very careful

OK, it worked, thanks

@pdvyas this does not work anymore. I tried to do bench set-mariadb-host {new host} an error will display

  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.92', 'console_scripts', 'bench')()
  File "/home/ubuntu/bench-repo/bench/cli.py", line 60, in cli
    bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/bench-repo/bench/cli.py", line 382, in _set_mariadb_host
    set_mariadb_host(host)
  File "/home/ubuntu/bench-repo/bench/utils.py", line 392, in set_mariadb_host
    update_common_site_config({'db_host': host}, bench=bench)
  File "/home/ubuntu/bench-repo/bench/utils.py", line 395, in update_common_site_config
    update_json_file(os.path.join(bench, 'sites', 'common_site_config.json'), ddict)
  File "/home/ubuntu/bench-repo/bench/utils.py", line 399, in update_json_file
    content = json.load(f)
  File "/usr/lib/python2.7/json/__init__.py", line 290, in load
    **kw)
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Any idea how to change to remote database server?

@pdvyas bench restore {new-sitename} {/path/to/sqlbackupfile} does not work anymore. bench restore only accept 1 parameter the sql file. I got this error

Error: Got unexpected extra argument (/home/ubuntu/frappe-bench/sites/site1.local/private/backups/20151219_33878916_database.sql.gz)

And the --force option is not also working. Error: no such option: --force
any ideas how to restore to a remote database?

I was able to solve this by bench --force --site site2 restore ~/path/20150526_38263610_database.sql as suggested by @Jonathan_Fanny_Lie