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.
Database name is hash value of your site name.
Explore new-site command in frappe’s command.py
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)
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.
try bench new-site --help. If there is an option for naming the db at creation time, it should show up
Thanks for guiding me.
It worked out .
frappe@piersoft:~/test-bench$ bench new-site test.local --db-name vivek
MySQL root password:
Updating DocTypes for frappe : [========================================]
Updating country info : [========================================]
Set Administrator password:
Re-enter Administrator password:
*** Scheduler is disabled ***
root@piersoft:~# mysql -p
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.