MySql 5.7 設置IP 訪問 ##密碼修改


 設置IP 訪問

##1.默認安裝目錄
cd C:\Program Files\mysql-5.7.16-winx64\bin

##2.登陸mysql數據庫
mysql -uroot -p

##3.查看user表
use mysql;
select host,user from user;

##4.更新IP
update user set host = 'xxx.xx.xx.xxx' where user = 'root';

##5.授權
Grant all on *.* to 'root'@'%' identified by 'xxxxxx' with grant option;
flush privileges;

##6.重啟mysql
net stop mysql;
net start mysql;

修改密碼

mysql5.6之前修改密碼(字段password)

mysql> use mysql;

mysql> update user set password=password(‘123‘) where user=‘root‘ and host=‘localhost‘;

mysql> flush privileges;

mysql 5.7.22版本修改密碼(字段是authentication_string)

mysql> use mysql;

mysql>update user authentication_string=password(‘root123‘) where user=‘root‘

mysql> flush privileges; --不重啟MySQL服務生效

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM