Fresh install no tables in DB

Guys you have a good product but I seriously think you should get someone to concentrate on documentation…

I have tried a setup as per GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps on a freshly installed server and it’s failing…

When installing the erpnext app I get:

Traceback (most recent call last):
File “/usr/lib/python2.7/”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/”, line 72, in _run_code
exec code in run_globals
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/utils/”, line 79, in
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/utils/”, line 16, in main
File “/opt/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 722, in call
return self.main(*args, **kwargs)
File “/opt/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 697, in main
rv = self.invoke(ctx)
File “/opt/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 535, in invoke
return callback(*args, **kwargs)
File “/opt/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/commands/”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/commands/”, line 153, in install_app
_install_app(app, verbose=context.verbose)
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 103, in install_app
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 484, in clear_cache
for fn in get_hooks(“clear_cache”):
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 800, in get_hooks
hooks = _dict(cache().get_value(“app_hooks”, load_app_hooks))
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/utils/”, line 70, in get_value
val = generator()
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 778, in load_app_hooks
for app in [app_name] if app_name else get_installed_apps(sort=True):
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 742, in get_installed_apps
installed = json.loads(db.get_global(“installed_apps”) or “[]”)
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 692, in get_global
return self.get_default(key, user)
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 704, in get_default
d = self.get_defaults(key, parent)
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 710, in get_defaults
defaults = frappe.defaults.get_defaults(parent)
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 72, in get_defaults
globald = get_defaults_for()
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 180, in get_defaults_for
where parent = %s order by creation"“”, (parent,), as_dict=1)
File “/opt/erpnext/frappe-bench/apps/frappe/frappe/”, line 138, in sql
self._cursor.execute(query, values)
File “/opt/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/”, line 205, in execute
self.errorhandler(self, exc, value)
File “/opt/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1146, “Table ‘1bd3e0294da19198.tabDefaultValue’ doesn’t exist”)

I have also tried to not install erpnext and run only frappe with bench start but even that does not work. Error in console is <> does not exist…

You have a brilliant project but if you do not document it it’s not really useful. I mean for people like me which are not experts as you guys…

The problem is with mysql. I guess it’s related to permission error.

Make sure you can successfully log into mysql (mariaDB) as root:
mysql -u root -p

Drop the database with the weird user name (e.g. ‘a46003081’),
mysql> drop database a46003081;

Drop the user with the same name as the database
mysql> drop user ‘a46003081’@‘localhost’;

sudo systemctl restart mysqld
bench --site site1.local --force reinstall
Now install erpnext and frappe app

1 Like

Hi. I have done my investigation. As you said the issue is MySQL (MariaDB)
I am using debian stretch and for some reason they have changed the behaviour of MariaDB.
Basically if you do a mysql -u root -p it won’t work anymore as the credentials are being taken from the login shell. In order to make MySQL work you have to issue a sudo.

Can this behaviour be modified in ERPNext?

I could install as the frappe user but I cannot set the MySQL user, but only the password. How can I overcome this?


Firstly, the reason I am commenting on your remarks is because you have clearly not read the documentation and therefore are encountering issues.

I have an install on Debian Wheezy without any issues and I’ve followed the documentation. I also have other installs on Ubuntu 14.04 and 16.10 and on macOS Sierra. All following the documentation.

So it would be great if instead of complaining about the documentation you actually take the time to go through and understand it.

@Fabrizio_Mazzoni , secondly, you are installing on an unreleased unstable Debian, secondly, as its clearly stated in the documentation, its an opinionated install, meaning, you kinda have to make sure you are following the same specs as recommended in the documentation.

With reference to the point above, that is the reason it is an opinionated install so that you a user does not encounter issues.

Can you imagine if the ERPNext Team has to accommodate/cater to every server configuration that exists. That would just be a nightmare.

NOTE: I am not commenting on behalf of ERPNext, I am simply expressing my opinion and mine alone, due to the fact that many do not actually read, investigate and search to try and resolve issues but instead immediately blame the application/project. I don’t think that is fair to the Team.

TIP if you wish to try it out use the SaaS version as an evaluation point.


OK. Thanks. Sorry for being a little harsh but am really getting frustrated!!! I do have to say the concept is quite difficult as I have seen other people commenting on this.
Anyway. As said in previous post the issue is definitely in MariaDB as MCD-50 pointed out. The tables are not being created. I’m investigating the matter now and if I find a solution I will definitely post.

@Fabrizio_Mazzoni - Not a problem and thank you for understanding.

Everyone is very helpful and I am certain collectively we can all find a solution.


OK. In regards to this issue I have tried to log the queries going on in MariaDB. It seems that commands to create the tables are not issued. I have setup MariaDB to work with default behaviour (no unix socket plugin for auth)

This is the log:

/usr/sbin/mysqld, Version: 10.1.22-MariaDB- (Debian 9.0). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
170406 6:34:02 2 Connect root@localhost as anonymous on
2 Statistics
2 Quit
170406 6:34:08 3 Connect root@localhost as anonymous on
3 Query SET NAMES utf8mb4
3 Query set autocommit=0
3 Query select user()
3 Query DROP USER ‘f9abf56295d9161a’@‘localhost’
3 Query DROP DATABASE IF EXISTS f9abf56295d9161a
3 Query select user()
3 Query CREATE USER ‘f9abf56295d9161a’@‘localhost’ IDENTIFIED BY ‘PeicnXGKgoq7lUaD’
3 Query CREATE DATABASE f9abf56295d9161a
3 Query select user()
3 Query GRANT ALL PRIVILEGES ON f9abf56295d9161a.* TO ‘f9abf56295d9161a’@‘localhost’
3 Quit
4 Connect f9abf56295d9161a@localhost as anonymous on
4 Query SET NAMES utf8mb4
4 Query set autocommit=0
4 Init DB f9abf56295d9161a
4 Query show variables
4 Quit
170406 6:35:01 5 Connect root@localhost as anonymous on
5 Statistics
5 Quit
170406 6:36:02 6 Connect root@localhost as anonymous on
6 Statistics
6 Quit
170406 6:36:06 7 Connect f9abf56295d9161a@localhost as anonymous on
7 Query SET NAMES utf8mb4
7 Query set autocommit=0
7 Init DB f9abf56295d9161a
7 Query select defkey, defvalue from tabDefaultValue
where parent = ‘__default’ order by creation
7 Quit

Can anyone assist?

More info. I have enabled logging in mysql and there are no errors. As said it seems that the install script is executing any query to create the tables:

170414 9:34:13 16 Connect root@localhost as anonymous on
16 Query SET NAMES utf8mb4
16 Query set autocommit=0
16 Query select user()
16 Query DROP USER ‘962665711e0e6ff3’@‘localhost’
16 Query DROP DATABASE IF EXISTS 962665711e0e6ff3
16 Query select user()
16 Query CREATE USER ‘962665711e0e6ff3’@‘localhost’ IDENTIFIED BY ‘5FhUh1ieq49L4CjN’
16 Query CREATE DATABASE 962665711e0e6ff3
16 Query select user()
16 Query GRANT ALL PRIVILEGES ON 962665711e0e6ff3.* TO ‘962665711e0e6ff3’@‘localhost’
16 Quit
17 Connect 962665711e0e6ff3@localhost as anonymous on
17 Query SET NAMES utf8mb4
17 Query set autocommit=0
17 Init DB 962665711e0e6ff3
17 Query show variables
17 Quit
170414 9:36:01 18 Connect root@localhost as anonymous on
18 Query select version()
18 Quit
170414 9:38:02 19 Connect root@localhost as anonymous on
19 Query select version()
19 Quit
170414 9:38:58 20 Connect 962665711e0e6ff3@localhost as anonymous on
20 Query SET NAMES utf8mb4
20 Query set autocommit=0
20 Init DB 962665711e0e6ff3
20 Query select defkey, defvalue from tabDefaultValue
where parent = ‘__default’ order by creation
20 Quit


I actually tried to install Frappe/ERPNext on Stretch and was not able to due to the significant changes in the system:

PRETTY_NAME="Debian GNU/Linux 9 (stretch)" NAME="Debian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" ID=debian HOME_URL="" SUPPORT_URL="" BUG_REPORT_URL=""

I am just curious, is there a really good/valid reason you want to install on Stretch, when v8 will be less painful :slight_smile:


These are the steps I took to successfully install on Debian Stretch

Please try the following steps to create tables if not created.

Note that for MariaDB you have to change configuration in my.cnf file and is one reason that tables are not created.
It is located at /etc/mysql/my.cnf. The instruction to change it is given on setup screen at the time of setup. For your reference it is give here.

innodb_file_per_table= 1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

default-character-set = utf8mb4

Before doing below steps make sure that database 1bd3e0294da19198 is available in MariaDB.

  1. bench --site site1.local --force reinstall
  2. bench new-site site1.local
  3. bench --site site1.local install-app erpnext

Check after step 2 and 3 in the database if tables are created.

Thank you very much. This was the solution! I wanted to . keep the config’s clean and was not placing the config options in my.cnf and this was the issue!

Very much appreciated.