Sunday, 19 July 2015

MySQL first Database and first User creation.

MySQL User and Database Creation. Step-by-Step.


# Connect to mysql database as root user.

mysql -h localhost -u root -p

# Create database myfirstdb; 

CREATE DATABASE IF NOT EXISTS myfirstdb;

# Create user; 

CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';

# Grant Specific Privileges to only myfirsdb

GRANT USAGE ON myfirstdb.* TO 'myfirstuser'@'localhost' IDENTIFIED BY 'mypassword' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;

# Grant Specific Privileges to only myfirsdb

GRANT ALL PRIVILEGES ON myfirstdb.* TO 'myfirstuser'@'localhost';




No comments:

Post a Comment