Mysql建立資料庫使用者

2021-10-11 18:47:16 字數 647 閱讀 8887

通常情況下我們在編寫**的過程中(也就是在開發過程中),一直使用的是我們本地的mysql,而且使用者都是root使用者,最高許可權的使用者,但是我們如果在公司上班的時候,公司的領導不會讓你擁有root許可權,這樣存在風險.這就需要建立普通的使用者.

開啟自己的cmd,輸入mysql -u root -p;輸入密碼:

建立資料庫,create database 資料庫的名字 charset utf8;

為資料庫建立使用者create user 資料庫的名字 identified by '資料庫密碼';

授權資料庫下的所有表的所有許可權給使用者在以任何ip訪問資料庫的時候使用grant all on 資料庫的名字 .* to '使用者名稱'@'%';

重新整理生效使用者許可權flush privileges;

希望可以幫到大家!!!

mysql建立資料庫,建立使用者

建立資料庫 create database test use test 建立使用者 create user test identified by test 給使用者賦權 grant all on test.to test 建立資料庫 命令 create database databasename 例...

mysql資料庫和使用者建立

1.建立資料庫 create database test 2.建立使用者 任何終端都可以連線 grant select,insert,update,delete on test.to user identified by 123456 只讓某個位址段連線 grant select,insert,up...

mysql 建立資料庫和使用者

1 用管理員賬號登陸mysql 2 建立資料庫 create database db01 3 建立使用者 create user user01 localhost identified by password1 user01只能本地訪問 create user user02 identified b...