MySQL settings under Ubunt allow remote connections

Source: Internet
Author: User

The first step:

Modifying a configuration file
sudo vi/etc/mysql/mysql.conf.d/mysqld.cnf

Find bind-address = 127.0.0.1
Comment out this line, such as: #bind-address = 127.0.0.1

or instead: Bind-address = 0.0.0.0
Allow any IP access;

Or specify an IP address yourself.

When editing is complete, enter: wq!

Save Exit Edit!

Step Two:

Log in to MySQL
>mysql-uroot-p123456

Then, switch to MySQL database. SQL is as follows:
The code is as follows:
>use MySQL;

Just want to modify an existing user (for example, root) to allow remote host access, you can use the following SQL to complete:
>update user set host= '% ' where user= ' root ' and host= ' localhost ';
Exit database
>mysql> exit;
Once you have completed all of the above steps, you will need to restart the database for the modified configuration to take effect. Execute the following command to restart the database
>sudo service MySQL restart;

Congratulations you have completed the configuration, you can try to remotely operate the MySQL database

MySQL settings under Ubunt allow remote connections

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.