關於mysql使用者的問題

2021-06-20 19:21:22 字數 941 閱讀 5556

一直以來我使用mysql的登陸都是mysql -uroot -p然後輸入密碼,好長時間都是這樣。今天學習了mysql資料庫還有其他使用者的說法,的確,我這兩年用的一直都是root這個超級使用者,select * from mysql.user;這句sql語句可以查詢mysql中所有的使用者以及使用者的相關許可權的資訊。

insert into mysql.user(host,user,password) values('localhost','kay',password('root'))使用這個語句在mysql中新增乙個使用者,使用這個使用者建立乙個資料庫,create database kaydb1暫時沒有任何許可權

mysql -ukay -proot發現連線不上資料庫,可以吧mysql伺服器重新啟動。

重新啟動之後以root使用者登入mysql -uroot -proot登入進去之後然後再為kay使用者賦予許可權,賦予許可權的語句是

grant all privileges on kaydb1.*  to

kay@localhost

identified by 'root';

這是賦予使用者所有的許可權,當然也可以賦予資料庫部分的許可權

grant insert,delete(select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file一共這14中許可權 )to kaydb1.* to

kay@localhost

identified by 'root';

刪除使用者delete from mysql.user where user='kay' and host='localhost';

修改密碼update mysql.user set password=password(『新密碼』) where user='kay' and host='localhost';

MySQL關於使用者的操作

create user lijiahui localhost identified by 123456 建立了乙個使用者,使用者名稱是lijiahui,密碼是123456 但是只能在本地登入!如果想建立乙個使用者可以遠端訪問,怎麼建立呢?create user lijiahui2 identifie...

MySQL 關於使用者的基本操作

建立使用者並授權 mysql grant all privileges on to user1 identified by 123456 建立完使用者再授權 mysql create user user2 192.168.1.0 24 identified by 123456 mysql grant...

關於使用者控制項的後台宣告問題

原文在 作者在引用使用者控制項時在後台的宣告 protected loginoutcontrol loginoutcontrol1 網上也有很多文章這樣寫,但執行過程報錯 編譯器錯誤資訊 cs0117 asp.webform1 aspx 並不包含對 loginoutcontrol1 的定義 源錯誤 ...