Linux (Ubuntu) server installed MySQL, set up limited ip, root password for remote access

1. Note bind-address = 127.0.0.1

sudo came /etc/mysql/mysql.conf.d/mysqld.cnf
 

The bind-address = 127.0.0.1 commented (i.e., the first line plus #), as follows:

code show as below:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address          = 127.0.0.1

In addition to watching out the sentence, but also the IP address can be later modified to permit the connection of the IP address

 

2. Check the user table, root of the plugin is auth_socket, with a password of plugin should be mysql_native_password

select user, host,plugin from mysql.user;

 

Set Password:

update mysql.user set authentication_string=PASSWORD('新密码'), plugin='mysql_native_password' where user='root';

flush privileges;

Related command:

Stop MySQL:

sudo service mysql stop

Start MySQL:

sudo service mysql  start

Guess you like

Origin www.cnblogs.com/LX51/p/12079683.html