Create User and Import Database
Create Database and User
Using MySQL Command Line
Step-by-step:
mysql -u root -p-- 1. Create the database
CREATE DATABASE example_db CHARACTER SET utf8 COLLATE utf8_general_ci;
-- 2. Create the user (if not exists)
CREATE USER 'example_db'@'localhost' IDENTIFIED BY 'PaSSw0rd';
-- 3. Grant all privileges to that user on the new database
GRANT ALL PRIVILEGES ON example_db.* TO 'example_db'@'localhost';
-- 4. Apply changes
FLUSH PRIVILEGES;Import Database
Prerequisites
Syntax
Example
Ensure the Database Exists
Import the .sql File via CMD
.sql File via CMDRun this:
Last updated