MySQL Schema Initialization Note | ATLASSC.NET
Skip to main content
/// .DATA.FRAGMENT_20181208

MySQL Schema Initialization Note

Initiate MySQL Database

Setting up a MySQL database for a new project, you basically have three things to do:

  • Create a database
  • Create a standalone database user for the database for security purposes
  • Grant privileges of the database to the new user
-- Create Database
CREATE DATABASE IF NOT EXISTS `<database_name>` CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
-- Create User
CREATE USER '<username>'@'%' IDENTIFIED BY '<password>';
-- Grant Privileges
GRANT ALL PRIVILEGES ON `<database_name>`.* TO '<username>'@'%';

Restore Database from Dump File

mysql -u [username] -p -h [host] -P [port] [dbname] < [filename].sql

Dump Database to File

mysqldump -u [username] -p -h [host] -P [port] [dbname] > [filename].sql

Dump Database to File with Compression

mysqldump -u [username] -p -h [host] -P [port] [dbname] | gzip > [filename].sql.gz
RackNerd Billboard Banner
Share node:
/// .RELATED.DATA_STREAMSShared tags

Related posts

Scanning_database_for_correlations…

/// .UPLINK.SUBSCRIBE

Keep your deck synced with every new transmission from ATLASSC.NET. Subscribe over RSS or Atom, or wire the whole archive straight into your AI assistant with the MCP server.