1.修改數據庫對指定用戶和ip權限
a. IP為192.168.0.1的用戶jack擁有對數據庫datebase的表table的 增刪改查權限, ,連接密碼為password
grant select,insert,update,delete,create,drop on database.table to jack@192.168.0.1 identified by 'password';
b. 192.168.0.1的用戶jack擁有對數據庫datebase所有表的所有操作權限,連接密碼為password
grant all privileges on datebase.* to jack@192.168.0.1 identified by 'password';
c. 192.168.0.1的用戶jack擁有對所有數據庫所有表的所有操作權限,連接密碼為password
grant all privileges on *.* to jack@192.168.0.1 identified by 'password';
2.linux登錄指定數據庫
mysql -P'port' -h'IP' -u'username' -p'password';
3.修改數據庫訪問密碼(mysql5.7以后mysql.user表中沒有了password字段,而是使用authentication_string來代替)
update mysql.user set authentication_string=password("new password") where User="username" and Host="localhost";
flush privileges;