О Высоких Технологиях и Жизненных Ситуациях

MySQL : command line

Create new user for MySQL DB from command line with name 'username' and password 'password':
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

Create database from linux (Ubuntu, CentOS) with name 'mydb' and charset 'utf8' and collate 'utf8_general_ci'
CREATE DATABASE `mydb` CHARACTER SET utf8 COLLATE utf8_general_ci; 

Give rights for all tables in 'mydb' for user 'username' with password 'password'

GRANT ALL ON `mydb`.* TO `username`@localhost IDENTIFIED BY 'password';

Update rights:

FLUSH PRIVILEGES;

Leave a comment for: "MySQL : command line"