An issue where only local connections cannot be connected remotely after MySQL server is installed on Ubuntu

Source: Internet
Author: User

After you install MySQL, you want to use another computer for remote login, you are prompted to reject the connection at logon

After Baidu, found that need two steps to solve the problem

    • Modify bind_address = 0.0.0.0 in/etc/mysql/my.cnf
    • To authorize

 (1)直接授权

Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT option;mysql>flush rivileges

  (2)改表法 可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改成”%”

Mysql-u root-p passwd mysql>use mysql;mysql>update user Set host = '% ' where user = ' root '; Mysql>select host, U Ser from user;
But in the first step, the content of MY.CNF is the following:
# # The MySQL database server configuration file.## You can copy this to one of:#-'/etc/mysql/my.cnf ' to set global Optio ns,#-"~/.my.cnf" to set user-specific options.# # One can use all long options, the program supports.# Run program W ITH--help to get a list of available options and with#--print-defaults to see which it would actually understand and use . # # for explanations see# http://dev.mysql.com/doc/mysql/en/server-system-variables.html # # * important:additional Settings that can override those from this file!#   the files must end with '. Cnf ', otherwise they ' ll be ignored.#!inclu dedir/etc/mysql/conf.d/!includedir/etc/mysql/mysql.conf.d/

Finally found that the need to modify is /etc/mysql/mysql.conf.d/mysqld.cnf

using sudo Vim /Etc/mysql/mysql.conf.d/mysqld.cnf

then restarting the MySQL service is available: sudo/etc/init.d/mysql restart

An issue where only local connections cannot be connected remotely after MySQL server is installed on Ubuntu

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.