I want to change data base name according to me is it possible

Hi ,

After bench get-app frappe , When we create new site , it will prompt for database password, so it is creating database and installing frappe.
who is giving the database name bench or frappe ( it may be random name or it may be generating with new name )
So as per my requirement, i want to have my own name to database.
so that should be reflected in site_config.json file also.

if that is possible can you guide me , how to do it.

1 Like

Database name is hash value of your site name.

Explore new-site command in frappe’s command.py

1 Like

Hi Saurabh,

yes it is the hash value of my site name.
I have verified it is using SHA-1 hash and first sixteen digit of your database name is our site name.

sitename is site1.local
This is my db name 1bd3e0294da191981 .

Original text site1.local
Original bytes 73:69:74:65:31:2e:6c:6f:63:61:6c (length=11)
Adler32 18ec0420
CRC32 6ab723f7
Haval e4f71e9ef59e1cb2d01edc1031858f6c
MD2 e98d6ae5523fb843adf61f80ca842505
MD4 a25f678c9aadbc17eb7795c1a2b5d2e8
MD5 a5586980e57a54b128d758ecf53a1f58
RipeMD128 d951a801ecb9bc4b37b7ad49aa0d051f
RipeMD160 0f01bd837f01dea65ef76155fc7194a709260e39
SHA-1 1bd3e0294da1919813b56847283be68112a0888a

But i did not understand this point
Explore new-site command in frappe’s command.py .

Means i need to find new-site command line in frappe.
or any thing is there in command.py file that we need to modify according to us.
provide me command.py file path.

Guide how to create database name according to my wish.
Means i want give database name as vivek.
when i do bench new-site sitename.

Please tell us Where i need to changes and what changes i need to do to get like that.

Vivekananda reddy

1 Like

try bench new-site --help. If there is an option for naming the db at creation time, it should show up

Hi vrms,

Thanks for guiding me.
It worked out .

frappe@piersoft:~/test-bench$ bench new-site test.local --db-name vivek
MySQL root password:

Installing frappe…
Updating DocTypes for frappe : [========================================]
Updating country info : [========================================]
Set Administrator password:
Re-enter Administrator password:
*** Scheduler is disabled ***
frappe@piersoft:~/test-bench$ exit
root@piersoft:~# mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5296
Server version: 10.1.24-MariaDB-1~trusty mariadb.org binary distribution

Copyright © 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> show databases;
| Database |
| 1bd3e0294da19198 |
| information_schema |
| mysql |
| performance_schema |
| vivek |
5 rows in set (0.00 sec)

Thanks for saurabh and vrms for guiding me.

1 Like