MySQL is installed by default after the installation of localhost access, if you need external access to set a new account to change the host to%, meaning that all IP can access
Grant all privileges on * * to ' outuser ' @ '% ' identified by ' + ' with GRANT option
And then
Flush privileges;
You can use Outuser account password 12来 external access, sometimes inaccessible need to open firewall open port
The Firewall-cmd command is used in CentOS 7
# firewall-cmd--list-all-zones #查看所有的zone信息 # firewall-cmd--get-default-zone #查看默认zone是哪一个 # firewall-cmd-- Zone=internal--change-zone=p3p1 #临时修改接口p3p1所属的zone为internal # firewall-cmd--add-service=http #暂时开放http # Firewall-cmd--permanent--add-service=http #永久开放http # firewall-cmd--zone=public--add-port=80/tcp--permanent #在public中永久开放80端口 # firewall-cmd--permanent--zone=public--remove-service=ssh #从public Zone Removal Service # Firewall-cmd--reload #重新加载配置
Open Port 3306
Firewall-cmd--add-port=3306/tcp--permanent
Ok
CENTOS7 Open MySQL 3306 port and set up external access