create a database in mysql ubuntu code example

Example 1: create user database mysql command ubuntu

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

Example 2: mysql create database

CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Example 3: connect to mysql database ubuntu

mysql -u USERNAME -p

Example 4: MySQL CREATE DATABASE

MySQL implements a database as a directory that contains all files which correspond to tables in the database.

To create a new database in MySQL, you use the CREATE DATABASE statement with the following syntax:

CREATE DATABASE [IF NOT EXISTS] database_name
[CHARACTER SET charset_name]
[COLLATE collation_name]

Tags:

Php Example