錄創(chuàng)建數(shù)據(jù)庫
mysql -u[你的數(shù)據(jù)庫賬號(hào)] -p[你的數(shù)據(jù)庫密碼]
mysql -uroot -proot??[回車]
show databases; [列出所有數(shù)據(jù)庫]?
create database shudao; [新建名為shudao的數(shù)據(jù)庫]
use shudao? [進(jìn)入shudao數(shù)據(jù)庫]
set names utf8mb4; [設(shè)置數(shù)據(jù)庫格式為 utf8]
導(dǎo)入數(shù)據(jù)庫文件
1畴嘶、將準(zhǔn)備好的 shudao.sql 文件放入 /usr/andrewhsu/mysql 文件夾
source??/usr/andrewhsu/mysql/shudao.sql
導(dǎo)出數(shù)據(jù)庫文件sql
mysqldump -u root -p --default-character-set=數(shù)據(jù)編碼 數(shù)據(jù)庫名稱> new.sql?
mysqldump -ushudao -p --default-character-set=utf8 coupon_member_api > coupon_member_api.sql?
創(chuàng)建用戶,增加數(shù)據(jù)庫權(quán)限
create user rtc@'%' identified by 'rtc123';
grant all privileges on rtc_member_api to 'rtc'@'%'identified by 'rtc123' with grant option;? ? 【單個(gè)數(shù)據(jù)庫權(quán)限】
grant all privileges on *.* to '用戶名'@'%'identified by '用戶密碼' with grant option;? ? 【所有數(shù)據(jù)庫權(quán)限】