Create a MySQL user and set the remote access to
grant usage on *.* to ‘fred‘@‘localhost‘ identified by ‘fred‘;//创建用户fred密码ferd select host,user,password from mysql.user where user=‘fred‘;//查看记录 grant all privileges on *.* to [email protected]‘%‘identified by ‘fred‘;//设置可以远程访问
Workaround:
1, change the table method:
It may be that your account is not allowed to log on remotely, only on localhost. This time, as long as the computer on the localhost, log in to MySQL, change the "MySQL" Database in the "User" table "host", from "localhost" to "%"
X:\>mysql-u Root-pvmware mysql> use MySQL; mysql> Update user Set host = '% ' where user = ' root '; Mysql> Select Host, user from user; mysql> flush Privileges; |
Note:mysql> flush privileges; Make the changes effective.
2. Authorization Law:
For example, if you want to myuser use MyPassword to connect to a MySQL server from any host.
Mysql> Grant all privileges on * * to ' myuser ' @ '% ' identified by ' MyPassword ' with GRANT OPTION; |
If you want to allow users to connect to the MySQL server from a host myuser IP 192.168.1.3 and use MyPassword as the password
Mysql> GRANT All privileges on * * to ' myuser ' @ ' 192.168.1.3 ' identified by ' MyPassword ' with GRANT OPTION; |
MySQL Remote server Access database