Java Learning Note--mysql Open 3306 interface with set user rights

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.