Database already exists

Hello,
I have remove frappe folder and install my erpnext again. Now I get the error that Database is already exists.
Adding frappe user
Installing frappe-bench
Setting up first site
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/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 69, in new_site
_new_site(db_name, site, mariadb_root_username=mariadb_root_username, mariadb_root_password=mariadb_root_password, admin_password=admin_password, verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 87, in _new_site
install_db(root_login=mariadb_root_username, root_password=mariadb_root_password, db_name=db_name, admin_password=admin_password, verbose=verbose, source_sql=source_sql,force=force, reinstall=reinstall)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 32, in install_db
create_database_and_user(force, verbose)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 54, in create_database_and_user
raise Exception(“Database %s already exists” % (db_name,))
Exception: Database 1bd3e0294d already exists

go to mysql and run drop database 1bd3e0294d and drop user 1bd3e0294d@localhost

1 Like

Thank you for ypur reply. But when I try to go to the mysql I got the error
ERROR 1045 (28000): Access denied for user ‘1bd3e0294d’@‘localhost’ (using password: YES)

@Zalak

Try logging into mysql using,

mysql -u root -p

Enter your root password and then run commands to drop the database and the user.

_Shreyas

I tried this but I got the same error. Do you have any other solution for this error?

Hello @Zalak,here are my steps for a clean reinstall of all the development environment including reinstall of mariadb.( I had that problem too ):smile:
NOTE: I am using Ubuntu server

  • So i stopped the frappe bench;
  • deleted the folders related with the application
  • stopped the database with: sudo /etc/init.d/mysql stop
  • deleted existing data related to existing databases with: sudo rm -rf /var/lib/mysql
  • uninstall mariadb with:
  • sudo apt-get purge mysql* mariadb*
  • sudo apt-get autoremove
  • sudo apt-get autoclean
  • get a fresh install script with: wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
  • reinstall all with: sudo bash setup_frappe.sh that i got from here

It works for me

@Zalak
Note that after the process the frappe_passwords.txt content changes, and it contains the new passwords for the reinstalled system. Keep them safe.

Tell me if it works

Thank you for reply.I tried this solution but still I am getting thid error
Stopping MariaDB database server mysqld [ OK ]
df: ‘/var/lib/mysql/.’: No such file or directory

  • /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!

I ran
mysql -u root -p

then

drop database 1bd3e0294d

but console hangs, it just shows

-> and blinking curser. please help

I got it.

forgot to use ;

command should be

drop database 1bd3e0294d;

2 Likes

Open Mysql workbench and drop database.

May I know How to do that?

Can we includes those working steps in github?

Type following commands: Bench Mariadb(V11) or Bench mysql(V10)

then drop appropriate database

Hello,

I have followed the steps as mentioned above.

After that I restored the database file and ran bench - -site site-name migrate command.

It is showing me could not find app erpnext_shopify.

Also, when I login to the site it is showing internal server error.

can it be u are trying to restore a v10 database in a v11 instance?
v10 had the shopify connector asa separate app, while it has been integrated into the core code in v11

1 Like

I’, trying to restore database file from erpnext v8.3.5 master

from v8.3.5 >> v11?

Yes, from v8.3.5 to v11.1.14

I have installed erpnext_shopify in the newer version and now I’m not getting that error.

But when I tried force restore command, I’m getting the below error in the browser.

Even though I am not 100% certain, I believe the most reasonable way to approach this is to update the v8 instance to v11 (v8 > v9 > v10 > v11) and then (if that is still necessary) restore that db to another instance.

I do not believe db restore can be used to skip the update procedure


that info (that you want to restore a v8 db into a v11 instance) should have been provided with your initial post