1. 程式人生 > >二、建立資料庫並分配操作許可權

二、建立資料庫並分配操作許可權

1、建立資料庫


<1>進入資料庫

mysql -u root -p mysql

<2>檢視資料庫,並建立新的資料庫

show databases;   #檢視資料庫
create database meiduo32 charset=utf8;

2、分配資料管理許可權


<1>建立管理使用者和密碼

# 建立使用者賬號 meiduouser, 密碼 meiduouser32 (由identified by 指明)
create user meiduouser identified by 'meiduouser32'
;
# 授權meiduo32資料庫下的所有表(meiduo32.*)的所有許可權(all)給使用者meiduouser,
# 在以任何ip訪問資料庫的時候('meiduoiser'@'%')
grant all on meiduo32.* to 'meiduouser'@'%';
# 重新整理生效使用者許可權
flush privileges;