How to create a database from shell command?

前端 未结 8 1738
难免孤独
难免孤独 2021-01-29 17:24

I\'m looking for something like createdb in PostgreSQL or any other solution that would allow me to create database with a help of a shell command. Any hints?

8条回答
  •  暖寄归人
    2021-01-29 18:04

    You can use SQL on the command line:

    echo 'CREATE DATABASE dbname;' | mysql <...>
    

    Or you can use mysqladmin:

    mysqladmin create dbname
    

提交回复
热议问题