Yugabyte,
is there a way I can create the YB DB and it's schema by running one script file with all the commands mentioned here (https://docs.yugabyte.com/latest/quick-start/explore/ysql/#docker)
Yugabyte,
is there a way I can create the YB DB and it's schema by running one script file with all the commands mentioned here (https://docs.yugabyte.com/latest/quick-start/explore/ysql/#docker)
You can execute queries with ysqlsh
from the command line using -c
, example we use that to create the database:
./bin/ysqlsh -c 'create database ybdemo;'
You can also execute sql scripts with ysqlsh using -f
(https://docs.yugabyte.com/latest/admin/ysqlsh/#f-filename-file-filename), example:
./bin/ysqlsh -d ybdemo -f share/schema.sql
This will execute the schema.sql
script into ybdemo
database. And repeat that for every .sql
file.