Category Archives: MySQL quick hacks

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’;

Download this Article in PDF: Download PDF