Skip to content

Database Commands

Mark Metcalfe edited this page Nov 22, 2021 · 5 revisions

The following commands can be used to directly access the database you want to manipulate.

Note that there is an existing tdb command that can do all this for you.

PostgreSQL

tdocker exec pgsqlXX psql -U postgres
CREATE DATABASE my_totara_db;

MySQL 5.7 & MariaDB

Change CONTAINER to your container (e.g. mysql or mariadb104)

tdocker exec CONTAINER mysql -u root -p"root"
CREATE DATABASE my_totara_db DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;

MySQL 8

tdocker exec mysql8 mysql -u root -p"root"
CREATE DATABASE my_totara_db DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs;

Microsoft SQL Server 2017

tdocker exec php-7.3 /opt/mssql-tools/bin/sqlcmd -S mssql -U SA -P "Totara.Mssql1"
CREATE DATABASE my_totara_db COLLATE Latin1_General_CS_AS ALTER DATABASE my_totara_db SET ANSI_NULLS ON ALTER DATABASE my_totara_db SET QUOTED_IDENTIFIER ON ALTER DATABASE my_totara_db SET READ_COMMITTED_SNAPSHOT ON;
GO
Clone this wiki locally