MySQL數(shù)據庫8.0.11版創(chuàng)建用戶及數(shù)據庫方法
1.使用root用戶進入mysql數(shù)據庫.
2.創(chuàng)建數(shù)據庫,將databasename換成數(shù)據庫名稱.
CREATE DATABASE `databasename` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
3.創(chuàng)建用戶 username為用戶名,password為密碼.
CREATE USER username IDENTIFIED BY 'password';
4.授權username用戶在databasename上的權限,all代表所有,可分為INSERT,SELECT,UPDATE等權限,%代表任何ip都可訪問該數(shù)據庫.
grant all privileges on databasename.* to 'username'@'%';
5.刷新
FLUSH PRIVILEGES;