MySQL how to turn on Telnet function

Source: Internet
Author: User
Tags mysql database

Do a website, to constantly update the database, contact the database must be MySQL. Sometimes when you build a station because the database and the site in different IP, this time need to use the program MySQL remote connection, and MySQL because of security factors, the default time users set is not remote connection, only local connection, this time will need to modify their settings. The following small series on the introduction of the Operation method.

Enter cmd command mode.

Mysql-h Localhost-u Mysql-p

Enter Password: Hu Jintao

Connect to the database.

mysql> use MySQL; (This DB stores various configuration information for MySQL)

Database changed

Mysql> select Host,user from user; (View user's permissions)

+-------------+-------+

| Host | user |

+-------------+-------+

| localhost | |

| localhost | Root |

| localhost | |

| localhost | MySQL |

+-------------+-------+

6 rows in Set (0.02 sec)

As you can see, you can only access it in localhost host mode.

Mysql> grant all privileges in *.* to ' root ' @ '% ' identified by ' password ' with Grant option;

(% means all external machines, if a particular machine is specified, change the% to the corresponding machine name; ') Root ' refers to the username to be used, where the password needs to be changed to the root password.

mysql> flush Privileges; (Run as sentence to take effect, or restart MySQL)

Query OK, 0 rows affected (0.03 sec)

Mysql> select Host,user from user; (View the user's permissions again)

+-------------+-------+

| Host | user |

+-------------+-------+

| % | MySQL |

| % | Root |

| localhost | |

| localhost | Root |

| localhost | |

| localhost | MySQL |

+-------------+-------+

Mysql>exit

Now try again: from the remote CMD side see can not log in, can log in, the general code can also be connected to the.

Small editing tips: Another need to note that the User Rights table is in the MySQL Database DB table, which detailed records of which users have permissions on which several databases have the right to operate, this is more important for multi-user management.

Related Article

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.