Home > Database > Mysql Tutorial > Instructions for setting up remote access to mysql database

Instructions for setting up remote access to mysql database

怪我咯
Release: 2017-07-05 11:14:45
Original
1431 people have browsed it

MySQL databaseWhat should I do if remote access is not allowed? This article provides three solutions. Friends in need can refer to

1. Table modification method.
It may be that your account does not allow remote login, only localhost. At this time, as long as you log in to mysql on the computer at localhost, change the "host" item in the "user" table in the "mysql" database from "localhost" to "%"
 mysql -u root -pvmwaremysql> use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
2. Authorization method. For example, you want myuser to connect to the mysql server from any host using mypassword.
 GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WI
TH GRANT OPTION;
If you want to allow user myuser to connect to the host with IP address 192.168.1.6 mysql server and use mypassword as the password
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3'IDENTIFIED BY
'mypassword' WITH GRANT OPTION;
The first method I used , I found that it didn’t work at first, so I checked it on the Internet and found that I executed one less statement mysql>FLUSH RIVILEGES
to make the modification effective.

Another method:
Run on the installationmysql machine:
 1. d:\mysql\bin\>mysql -h localhost -u root
 //This should be able to enter the MySQL server
 2 , mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION
//Give any host permission to access data
3. mysql>FLUSH PRIVILEGES
//Modification takes effect
 4. mysql>EXIT
 //ExitMySQL server
In this way, you can log in as root on any other hosts.

The above is the detailed content of Instructions for setting up remote access to mysql database. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template