When the CentOS lamp environment is configured, access to the remote server is denied.

Source: Internet
Author: User

When the lamp environment is configured, we are in this machine: 192.168.0.130 use Navicat to connect to the server: 192.168.0.168 will appear when remote MySQL does not allow access to the error, because MySQL for security, By default, users are allowed to log on locally only, we are now in the case of using phpMyAdmin or Navicat to log in, database management, then how to do? We need to do the following:

First, if the root user is allowed to telnet anywhere, and have all the library operation permissions, the following actions:
Log in to MySQL using the root user first:
Mysql-u root-p "Youpassword"
To authorize the operation:
Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' Youpassword ' with GRANT OPTION;
Overload Authorization Table:
FLUSH privileges;
To exit the MySQL database:
Exit


Second, if only allow the root user in a specific IP remote login, and have all the library operation permissions, the following actions:
Log in to MySQL using the root user first:
Mysql-u root-p "Youpassword"
To authorize the operation:
GRANT all privileges on * * to [email protected] "specified IP" identified by "Youpassword" with GRANT OPTION;
Overload Authorization Table:
FLUSH privileges;
To exit the MySQL database:
Exit


Assume that only the root user is allowed to telnet on a specific IP and have all the library-specific operations permissions, as follows:
Log in to MySQL using the root user first:
Mysql-u root-p "Youpassword"
To authorize the operation:
GRANT select,insert,update,delete On * * to [email protected] "specific IP" identified by "Youpassword";
Overload Authorization Table:
FLUSH privileges;
To exit the MySQL database:
Exit


Iv. If you need to remove the user authorization, you need to use the revoke command, the specific command format is:
REVOKE privileges on database [. Table name] from User-name;
For specific instances, first log in to MySQL:
Mysql-u root-p "Youpassword"
To authorize the operation:
GRANT Select,insert,update,delete on test-db to [email protected] "Specify IP" identified by "Youpassword";
Then delete the authorization action:
REVOKE all on test-db from Test_user;
Note: This action only clears the user's authorization rights for TEST-DB, but this "test_user"

The user still exists.
Finally, clear the user from the user table:
DELETE from user WHERE user= "Test_user";
Overload Authorization Table:
FLUSH privileges;
To exit the MySQL database:
Exit

V. MySQL permissions detailed classification:
Global Administrative permissions:
File: Read and write files on the MySQL server.
PROCESS: Displays or kills service threads belonging to other users.
RELOAD: Overloads the Access Control table, refreshes the log, and so on.
SHUTDOWN: Turn off the MySQL service.
Database/data Table/Data column permissions:
Alter: Modifies an existing data table (for example, add/Remove Columns) and index.
Create: Create a new database or data table.
Delete: Deletes the record for the table.
Drop: Deletes a data table or database.
Index: Establish or delete the indexes.
INSERT: Adds a table record.
SELECT: Displays/searches the table's records.
UPDATE: Modifies a record that already exists in the table.
Special permissions:
All: Allow to do anything (as root).
USAGE: Only allow login-nothing else is allowed.

When the CentOS lamp environment is configured, access to the remote server is denied.

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.