Home>Article>Database> mysql prohibit external access solution

mysql prohibit external access solution

little bottle
little bottle forward
2019-04-19 14:10:01 3933browse

This article mainly talks about the solution when MySQL prohibits external access. It has a certain collection value. Friends in need can learn about it.

1. When the port is open, ubuntu mysql 3306 allows remote access
vim /etc/mysql/mysql.conf.d/mysqld.cnf
Comments#bind- address = 127.0.0.1

2. Authorize the user to allow remote access:
grant all privileges on *.* to root@"%" identified by "pwd" with grant option;
flush privileges ;

Create and authorize users to test certain permissions, operations in the user table of mysql database

1.mysql creates users:
CREATE USER 'taoshihan'@'localhost ' IDENTIFIED BY '';
localhost is just local
% is allowed to be remote
CREATE USER 'taoshihan115'@'%' IDENTIFIED BY 'TAOshihan1';

Delete user:
drop user 'taoshihan'@'localhost'

2.Authorization:
GRANT select ON *.* TO 'taoshihan115'@'%';Authorization specification
GRANT all ON *.* TO ' taoshihan115'@'%';Authorize all

When mysql cannot be restarted, check whether the log directory such as /var/log/mysql exists, and whether the group and owner are mysql

If not, create the directory and change the owner of the directory chown mysql:mysql

If you want to know more mysql tutorials, please pay attention to the PHP Chinese website to learn moremysql tutorials!

The above is the detailed content of mysql prohibit external access solution. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete