wheels db create
Create a new database based on your datasource configuration.
Synopsis
Description
The wheels db create
command creates a new database using the connection information from your configured datasource. The datasource must already exist in your CFML server configuration - this command creates the database itself, not the datasource.
Options
--datasource=
Specify which datasource to use. If not provided, uses the default datasource from your Wheels configuration.
--environment=
Specify the environment to use. Defaults to the current environment.
Examples
Basic Usage
Create database using default datasource:
Specific Datasource
Create database for development:
Create database for testing:
Database-Specific Behavior
MySQL/MariaDB
Creates database with UTF8MB4 character set
Uses utf8mb4_unicode_ci collation
Connects to
information_schema
to execute CREATE DATABASE
PostgreSQL
Creates database with UTF8 encoding
Checks if database already exists before creating
Connects to
postgres
system database
SQL Server
Creates database with default settings
Checks if database already exists before creating
Connects to
master
system database
H2
Displays message that H2 databases are created automatically
No action needed - database file is created on first connection
Prerequisites
Datasource Configuration: The datasource must be configured in your CFML server admin
Database Privileges: The database user must have CREATE DATABASE privileges
Network Access: The database server must be accessible
Error Messages
"Datasource not found"
The specified datasource doesn't exist in your server configuration. Create it in your CFML admin first.
"Database already exists"
The database already exists. Use wheels db drop
first if you need to recreate it.
"Access denied"
The database user doesn't have permission to create databases. Grant CREATE privileges to the user.
Related Commands
wheels db drop
- Drop an existing databasewheels db setup
- Create and setup databasewheels dbmigrate latest
- Run migrations after creating database
Last updated
Was this helpful?