Basic MySQL functions

under mysql
create a database:
CREATE DATABASE database_name;

add user:
GRANT usage on *.* to user@localhost identified by 'password';

grant privileges on database to user:
GRANT all privileges on database_name.* to user@localhost;

switch to database:
USE database_name;

not under mysql
create dump file:
mysqldump -uUSERNAME -pPASSWORD --default-character-set=utf8 database_name > backup.sql

import database:
mysql -uUSERNAME -pPASSWORD --default-character-set=utf8 database_name backup.sql

Leave a Comment

Before leaving a comment, please ensure you have read and understand my comments policy and my privacy policy. Any comment that does not abide by the comment policy will be deleted immediately.

Related Posts