System Ubuntu16.04 LTS
1. Open 3306 Port
To view port status:
Netstat-an|grep 3306
TCP 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
Currently, only the local machine can access
Input instructions:
sudo vim/etc/mysql/mysql.conf.d/mysqld.cnf
If you have previously configured a global profile, you can also enter directives:
sudo vim/etc/mysql/my.cnf
Modify the file, find the following line, add a # in front of BIND
Bind-address = 127.0.0.1
: Wq exit
To restart MySQL:
Sudo/etc/init.d/mysql restart
[OK] Restarting MySQL (via Systemctl): Mysql.service.
To view port status:
Netstat-an|grep 3306
TCP6 0 0::: 3306:::* LISTEN
This port is released.
2. The following MySQL new remote connection user
New username Password Open remote connection (for all LAN hosts):
GRANT all privileges on * * to ' myuser ' @ ' percent ' identified by ' MyPassword ' with GRANT OPTION;
New username Password open remote connection (IP specified in LAN)
GRANT all privileges on * * to ' myuser ' @ ' 192.168.1.3 ' identified by ' MyPassword ' with GRANT OPTION;
To delete a user:
Use MySQL;
Delete from user where user= ' admin ' and host= '% ';
New non-privileged User:
Grant usage on *. foreigner ' @ '% ' identified by ' foreigner ';
Increase its permissions:
Grant all privileges the db.* to ' foreigner ';
Recall permission:
Revoke all privileges in db.* from ' foreigner ' @ '% ';
To view permissions:
Mysql> Show grants for ' foreigner ' @ '% ';
+-----------------------------------------------------+
| Grants for [email protected]% |
+-----------------------------------------------------+
| GRANT USAGE on * * to ' foreigner ' @ '% ' |
| GRANT all Privileges "Soso". * to ' foreigner ' @ '% ' |
+-----------------------------------------------------+
2 rows in Set (0.00 sec)
Java Learning Note--mysql Open 3306 interface with set user rights