1. 程式人生 > 實用技巧 >部落格第一天

部落格第一天

使用Navicat工具,進行遠端授權登入

一、使用root使用者登入到mysql

mysql -u root -p

 

 

 查詢資料庫 show databases;

 

 

 使用mysql資料庫(真正的資料庫,而非資料庫軟體),將所有資料庫的所有表(*.*)的所有許可權(all privileges),授予通過任何ip(%)訪問的root使用者,密碼為為你自己設定的密碼,執行下面的命令,最後重新整理(flush privileges)即可。重新整理之後重啟mysql

use  mysql;

grant all privileges on *.* to 'root'@'%' identified by '你自己設定的密碼' with grant option; flush privileges;

  service mysqld restart

開放防火牆埠:

開啟防火牆:

啟動: systemctl start firewalld 檢視狀態: systemctl status firewalld  禁用,禁止開機啟動: systemctl disable firewalld 停止執行: systemctl stop firewalld

開放防火牆埠3306:

firewall-cmd --zone=public --add-port=3306/tcp --permanent

重新載入:

firewall-cmd --reload

檢視所有開啟的埠:

firewall-cmd --zone=public --list-ports

 

 再去Navicat遠端連線mysql

就會發現連線成功