mysql服務器設置對外訪問權限的方法
1.首先,在命令行中啟動mysql服務;
Linux:service mysql start
Windows:net start mysql
2.mysql服務啟動后,在命令行中輸入mysql的用戶名和密碼,登錄到mysql;
mysql -u root -p
3.登錄到mysql后,在mysql中開啟對外訪問權限;
#允許任意用戶遠程訪問到mysql
GRANT ALL PRIVILEGES ON *.* TO 'bd'@'%' IDENTIFIED Y 'bdpw' WITH GRANT OPTION;
#允許特定IP地址的用戶遠程訪問到mysql
GRANT ALL PRIVILEGES ON *.* TO 'bd'@'172.16.4.198' DENTIFIED BY 'bdpw' WITH GRANT OPTION;
4.最后,對外訪問權限設置好后,對授權表進行更新,權限即可生效;
FLUSH PRIVILEGES;