Enable remote port 16.04 and 16.04mysql5.7.17 for mysql5.7.17 in ubuntu 3306

Source: Internet
Author: User

Enable remote port 16.04 and 16.04mysql5.7.17 for mysql5.7.17 in ubuntu 3306

Enable MySQL Remote Access Permissions

By default, mysql users do not have the permission for remote access. Therefore, when the program is not on the same server as the database, we need to enable the remote access permission for mysql.

There are two mainstream Methods: table modification and authorization.

Relatively speaking, it is easier to change the table method. individuals prefer to use this method. Therefore, only the alter table method is attached here.

1. log on to mysql

Mysql-u root-p

2. Modify the user table of the mysql database and change the host item from localhost to %. % This indicates that access from any host is allowed. If only one ip address is allowed, you can change it to the corresponding ip address. For example, you can change localhost to 192.168.1.123, this means that only the ip address 192.168.1.123 of the LAN can remotely access mysql.

mysql> use mysql; mysql> select host,user form user; mysql>update user set host = '%' where user ='root'; mysql>select host,user from user; mysql> flush privileges; mysql> quit; 

First, check whether netstat-an | grep 3306 is enabled on the port.

Open the mysql configuration file vim/etc/mysql. conf. d/mysqld. cnf
Unregister bind-address = 127.0.0.1
Restart ubuntu
Check whether netstat-an | grep 3306 is enabled on the port again.

======================================

Grant the root user permission to the connection: grant all privileges on *. * to 'root' @ '% 'identified by 'xxxxxx ';
The last one is the mysql password.
Apply permissions immediately: flush privileges;

The operation is complete. You can connect to the mysql database server on any host.

MySQL remote connection cannot solve: http://www.bkjia.com/article/103770.htm

Centos7.1 open port firewall: http://www.bkjia.com/article/103777.htm

CentOS 7 Open-Port: http://www.bkjia.com/article/103773.htm

Ubuntu 15.04 mysql Open remote port 3306: http://www.bkjia.com/article/103784.htm

Http://www.bkjia.com/article/103766.htm

root@3bc476b7e0d5:~# vim /etc/mysql/mysql.conf.d/mysqld.cnf root@3bc476b7e0d5:~# netstat -an | grep 3306 tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 
root@3bc476b7e0d5:/# service mysql enable Usage: /etc/init.d/mysql start|stop|restart|reload|force-reload|status root@3bc476b7e0d5:/# netstat -an | grep 3306 tcp6 0 0 :::3306 :::* LISTEN root@3bc476b7e0d5:/# mysql --version mysql Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using EditLine wrapper root@3bc476b7e0d5:/# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.16-0ubuntu0.16.04.1 (Ubuntu)  Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.  Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | fabric | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.02 sec) 

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.