設定mysql root密碼:
mysql -u root
mysql> set password for 'root'@'localhost' = password('newpass');
mysql為了安全性,在預設情況下使用者只允許在本地登入,可是在有此情況下,還是需要使用使用者進行遠端連線,因此為了使其可以遠端需要進行如下操作:
一、允許root使用者在任何地方進行遠端登入,並具有所有庫任何操作許可權,
具體操作如下:
在本機先使用root使用者登入mysql: mysql -u root -p"youpassword" 進行授權操作:
mysql>grant all privileges on *.* to 'root'@'%' identified by 'youpassword' with grant option;
過載授權表:
flush privileges;
退出mysql資料庫:
exit
二、允許root使用者在一個特定的ip進行遠端登入,並具有所有庫任何操作許可權,具體操作如下: 在本機先使用root使用者登入mysql: mysql -u root -p"youpassword" 進行授權操作: grant all privileges on *.* to [email protected]"172.16.16.152" identified by "youpassword" with grant option; 過載授權表: flush privileges; 退出mysql資料庫: exit
三、允許root使用者在一個特定的ip進行遠端登入,並具有所有庫特定操作許可權,具體操作如下: 在本機先使用root使用者登入mysql: mysql -u root -p"youpassword" 進行授權操作: grant select,insert,update,delete on *.* to [email protected]"172.16.16.152" identified by "youpassword"; 過載授權表: flush privileges; 退出mysql資料庫: exit
四、刪除使用者授權,需要使用revoke命令,具體命令格式為: revoke privileges on 資料庫[.表名] from user-name; 具體例項,先在本機登入mysql: mysql -u root -p"youpassword" 進行授權操作: grant select,insert,update,delete on test-db to [email protected]"172.16.16.152" identified by "youpassword"; 再進行刪除授權操作: revoke all on test-db from test-user; ****注:該操作只是清除了使用者對於test-db的相關授權許可權,但是這個“test-user”這個使用者還是存在。 最後從使用者表內清除使用者: delete from user where user="test-user"; 過載授權表: flush privileges; 退出mysql資料庫: exit
mysql為了安全性,在預設情況下使用者只允許在本地登入,可是在有此情況下,還是需要使用使用者進行遠端連線,因此為了使其可以遠端需要進行如下操作:
一、允許root使用者在任何地方進行遠端登入,並具有所有庫任何操作許可權,
具體操作如下:
在本機先使用root使用者登入mysql: mysql -u root -p"youpassword" 進行授權操作:
mysql>grant all privileges on *.* to 'root'@'%' identified by 'youpassword' with grant option;
過載授權表:
flush privileges;
退出mysql資料庫:
exit
二、允許root使用者在一個特定的ip進行遠端登入,並具有所有庫任何操作許可權,具體操作如下: 在本機先使用root使用者登入mysql: mysql -u root -p"youpassword" 進行授權操作: grant all privileges on *.* to [email protected]"172.16.16.152" identified by "youpassword" with grant option; 過載授權表: flush privileges; 退出mysql資料庫: exit
三、允許root使用者在一個特定的ip進行遠端登入,並具有所有庫特定操作許可權,具體操作如下: 在本機先使用root使用者登入mysql: mysql -u root -p"youpassword" 進行授權操作: grant select,insert,update,delete on *.* to [email protected]"172.16.16.152" identified by "youpassword"; 過載授權表: flush privileges; 退出mysql資料庫: exit
四、刪除使用者授權,需要使用revoke命令,具體命令格式為: revoke privileges on 資料庫[.表名] from user-name; 具體例項,先在本機登入mysql: mysql -u root -p"youpassword" 進行授權操作: grant select,insert,update,delete on test-db to [email protected]"172.16.16.152" identified by "youpassword"; 再進行刪除授權操作: revoke all on test-db from test-user; ****注:該操作只是清除了使用者對於test-db的相關授權許可權,但是這個“test-user”這個使用者還是存在。 最後從使用者表內清除使用者: delete from user where user="test-user"; 過載授權表: flush privileges; 退出mysql資料庫: exit
mysql 賬號授權
一 移除許可權 revoke all privileges on py bond 2 1.from pycf flush privileges 二 新增使用者並授權 grant select,delete,insert,update on py private fof.to private fof ...
mysql 給賬號授權 MySQL賬號授權操作
mysql為了安全性,在預設情況下使用者只允許在本地登入,可是在有此情況下,還是需要使用使用者進行遠端連線,因此為了使其可以遠端需要進行如下操作 一 允許root使用者在任何地方進行遠端登入,並具有所有庫任何操作許可權,具體操作如下 在本機先使用root使用者登入mysql mysql u root...
mysql授權操作
1 檢視現有使用者 select host,user,authentication string from mysql.user 2 新建使用者 create user username host identified by password 3 刪除使用者 drop user username h...