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!