MySQL: Quick way to add user and database from command line

mysql_quick_way_to_add_user_and_database-command
Quick command way to create database and user for MySQL server:

From shell (bash, zsh) command line issue:
mysqladmin -u “root” –password=”YOUR_ADMIN_PASSWORD” create YOURNEWDATABASENAME

Connect to mysql with Mysql cli:

mysql -u root -p
password:

To add new username in SQL issue in MySQL server command:

GRANT ALL on YOURNEWDATABASENAME.*
TO ‘NEW_USERNAME’@’localhost’
IDENTIFIED BY ‘YOUR_NEW_PASSWORD’;

Leave a Reply

Your email address will not be published. Required fields are marked *