ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Database already exists


#1

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


Backup and Restore procedure
Backup and restore
#2

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


#3

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)


#4

@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


#5

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


#6

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


#7

@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


#8

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!

#9

I ran
mysql -u root -p

then

drop database 1bd3e0294d

but console hangs, it just shows

-> and blinking curser. please help


#10

I got it.

forgot to use ;

command should be

drop database 1bd3e0294d;


#11

Open Mysql workbench and drop database.


#12

May I know How to do that?

Can we includes those working steps in github?


#13

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

then drop appropriate database