How does MySQL enable remote access permissions?

Source: Internet
Author: User
I. Windows environment 1. Change the table. It may be that your account is not allowed to log on remotely, but only on localhost. At this time, you only need to log in to mysq on the computer of localhost.

I. Windows environment 1. Change the table. It may be that your account is not allowed to log on remotely, but only on localhost. At this time, you only need to log in to mysq on the computer of localhost.

I. Windows Environment

1. Change the table. It may be that your account is not allowed to log on remotely, but only on localhost. At this time, you only need to log in to mysql on the computer of localhost, and change the "host" entry in the "user" table in the "mysql" database to "%" from "localhost"

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, if you want myuser to use mypassword to connect to the mysql server from any host.

Grant all privileges on *. * TO 'myuser' @ '%' identified by 'mypassword' with grant option;

If you want to allow myuser to connect to the mysql server from a host whose ip address is 192.168.1.3, and use mypassword as the password

Grant all privileges on *. * TO 'myuser' @ '192. 168.1.3 'identified BY 'mypassword' with grant option;

My mysql. in the user, the root user's host is indeed localhost. First, change localhost to "%" by modifying the table method, or not. The error 1130 is still reported ,, again press the "connect to mysql server from any host" method to authorize, or report the same error, and finally authorize your own ip address, finally login ....

Hu hu...

Mysql ERROR 1045 in the above case, if the customer segment 1045 appears again, you can execute the following on the server:

UPDATE user SET Password = PASSWORD ('000000') where USER = 'myuser ';

Flush privileges; // used to refresh data after the user pays the permission! Otherwise, the Mysql database cannot be recognized.

For example: (you must refer to the preceding example)

Grant all on *. * TO admin @ '%' identified by 'admin' with grant option;

Mysql "192.168.50.85" "admin" "admin ";

Grant all on *. * TO admin @ 'localhost' identified by 'admin' with grant option;

Grant all privileges on *. * TO 'myuser' @ '%' identified by '000000' with grant option;

Grant all privileges on *. * TO 'myuser' @ '192. 168.50.85 'identified by '20140901' with grant option;

UPDATE user SET Password = PASSWORD ('000000') where USER = 'myuser ';

Flush privileges;

Mysql does not enable remote control by default. You must add a remote access user.

Mysql does not enable remote control by default. You must add a remote access user. G & 00 x $ Y

0VE} 0 (fQ

For the installation version, go to the console provided by mysql. 1 s + <(0R/

Log On with the root user, and then: Q k C jgS0

Grant all privileges on *. * to the created username @ "%" identified by "password"; o! Q *) 'xuq

Flush privileges; * refresh the content just now *)/z (5 3X

; (Q: LY \ v

Format: grant permission on database name. Table name to user @ login host identified by "User Password";. = h j Qi [

@ The IP address (or host name) % of the client accessing mysql represents any client. If localhost is set to local access (then this user cannot remotely access the mysql database ). U
Lp 8 z Rc

You can also set the remote access permission for existing users. As follows: \ ch3 X #

Use mysql; o $ '>:> N e

Update db set host = '%' where user = 'username'; (if it is written as host = localhost, this user does not have the remote access permission) B Gnl: R *

Flush privileges; zn 6en ;&?

3 Pj_2B =

View the result and run: $ 4b 5-U.

Use mysql;) {['66!

Select host, user, password from user; J): H \ B: j_M

I oZ 0 "H

+ -------------- + -------- + --------------- + T75 JSdQ

| Host | User | Password | XKL Di {U

+ -------------- + -------- + ----------------- + B * 1Q <Cx5B

| Localhost | U 8RZq (f

| % | John | 123456 | r'al B

| Localhost | root | H fd ZE

+ -------------- + ------ -- + --------------- + Pd7 = 8 8

ArJ ~ Vs "+

Conclusion :? Av l' B

In fact, by default, MySQL has two databases: mysql and test, and the information of MySQL users is stored in the related table of mysql. gb: hj/

You can also use a GUI tool such as Navicat (recommended) to manage users. HUD ?} U BB5

Update user set host = '%' where host = 'localhost'

The web server and mysql Server are not installed on the same computer. You need to access mysql through a remote account of mysql.

First, the syntax is as follows:

Grant [permission] on [database name]. [Table life] to ['user life '] @ ['web Server IP address'] identified by ['Password'];

Instance:

Grant all on lportal. * to 'root' @ '192. 168.1.21 identified by 'root ';

Grant select, update, insert, delete on lportal. * to 'root' @ '192. 168.1.21 identified by 'root ';

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.