Enable MySQL remote access in Ubuntu 15

Not too familiar, I have studied for a long time
first reference (most blogs are written like this)
http://java-my-life.iteye.com/blog/1202015
but encountered problems
  1./etc/mysql/my. The cnf file did not find bind-address = 127.0.0.1, that is, the configuration parameters were empty.
After
many searches, it was found in /etc/mysql/mysql.conf.d/mysqld.cnf   1. Maybe /etc/mysql/mysql. conf.d/mysqld.cnf is also empty. The
solution
is   to execute three commands according to the method here: http://computerbeginnersguides.com/blog/2015/11/04/install-mysql-server-on-ubuntu-15 -10/
  Specific steps:
   1.sudo apt-get install mysql-server-5.6 When asked, enter y
   2.sudo mysql_install_db
   3.sudo mysql_secure_installation
     Specific prompts and input values
      ​​Enter current password for root (enter for none): 123456
      Change the root password? [Y/n] n
      Remove anonymous users? [Y/n] n
      Disallow root login remotely? [Y/n] n
      Remove test database and access to it? [Y/n] n
      Reload privilege tables now? [Y/n] yAfter
   performing the above steps /etc/mysql/mysql.conf.d There is bind-address = 127.0.0.1 in /mysqld.cnf. After the
above
execution is completed, execute the following:   1. service mysql stop 
  2. Change bind-address = 127.0.0.1 to bind-address = 0.0.0.0 ( Note in /etc/mysql/mysql.conf.d/mysqld.cnf)
  3.service mysql start 
  4.mysql -u root -p (remember to enter password: 123456)
  5.update user set host = '%' where user ='root' and host='localhost';(Add the condition of host='localhost', otherwise the primary key conflicts, many blogs do not say this)
  6.flush privileges; 7.You 
  can check whether the setting is successful select host, user from user;
  8. You can view netstat -an | grep 3306  
    tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 
Remember that Ubuntu must support the ssh service first, this can be found online, it is relatively simple to
complete

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326762990&siteId=291194637