標籤:pre sel roo creat The ado service oca password
建立使用者及密碼mysql> create user ‘zhao‘@‘loacl‘ identified by ‘123123‘;mysql> use mysql;
建立密文密碼mysql> select password(‘123123‘); #查看明文對應的密文
mysql> create user ‘test01‘@‘localhost‘ identified by #建立密文密碼 ‘E56A114692FE0DE073F9A1DD68A00EEB9703F3F1‘;刪除使用者mysql> drop user ‘test01‘@‘localhost‘;
修改已存在使用者的密碼set password =pssword(‘123123‘);修改其他使用者密碼set password for ‘user02‘@‘localhost‘ = password(‘123abc‘);重新命名使用者mysql> rename user ‘zz‘@‘host‘ to ‘user01‘@‘host‘;
使用者授權mysql> grant select,update on *.* to ‘user01‘@‘localhost‘ identified by ‘123123‘; #給使用者user01添加對所有庫和表擁有select,update許可權
取消使用者授權mysql> revoke update on *.* from ‘user01‘@‘localhost‘; #對user01使用者取消update許可權
使用者忘記密碼1.修改設定檔systamctl stop mysqld.service #關掉資料庫vim /etc/my.cnf skip-grant-tables #在mysqld這段最下面插入(跳過驗證)systamctl start mysqld.service #開啟資料庫2.直接進入資料庫修改密碼mysql #直接進入資料庫mysql> update mysql.user set authentication_string =passwordd(‘123123‘);mysql> quit3.測試登入資料庫[[email protected] data]# mysql -uroot -p123123...... 省略部分內容mysql> #成功進入mysql資料庫
mysql資料庫管理