Skip to content

Database

Valet Linux+ automatically installs MySQL 5.7 with 5.6 compatibility mode included. It includes a tweaked my.cnf which is aimed at improving speed.

If you prefer to install MariaDB rather than MySQL then just use --mariadb with valet install command

List databases

You can get list of all databases with single command

valet db:list

Creating database

Create new database using:

valet db:create <name>

When no name is given it'll try to find the closest git repository directory name. When it can't find one it'll use the current working directory name.

valet db:create

Dropping database

Drop a database using:

valet db:drop <name>

When no name is given it'll try to find the closest git repository directory name. When it can't find one it'll use the current working directory name.

valet db:drop

Resetting database

Drop and create a database using:

valet db:reset <name>

When no name is given it'll try to find the closest git repository directory name. When it can't find one it'll use the current working directory name.

valet db:reset

Exporting database

Export a database:

valet db:export <database>

When no database name is given it'll use the current working directory name.

All database exports are gzipped. You can still export SQL file using --sql flag as shown below

valet db:export <database> --sql

Importing database

Import a database with progress bar

valet db:import <database_name> <filename>.sql

When no name is given it'll try to find the closest git repository directory name. When it can't find one it'll use the current working directory name.

You can import .sql directly as well as gzipped .sql.gz database exports.