How to create a database from shell command?

前端 未结 8 1960
难免孤独
难免孤独 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:27

    mysqladmin -u$USER -p$PASSWORD create $DB_NAME
    

    Replace above variables and you are good to go with this oneliner. $USER is the username, $PASSWORD is the password and $DB_NAME is the name of the database.

提交回复
热议问题