MySQL settings allow users to Telnet

Source: Internet
Author: User
Tags mysql client

1. //log in to databaseMysql-u root-pvmwaremysql>Use MySQL; //% can be accessed remotely for all IPsMysql>update UserSetHost ='%' whereuser ='Root'; //or just add a statement.Mysql>insert into User (Host,user,password) VALUES ('192.168.0.51','Root', Password ('123')); //Check the changesMysql>SelectHost, user fromuser; //push settings to memory or restart the server is also OKMysql>FLUSH Privileges2. GRANT all Privileges on*. * To'MyUser'@'%'Identified by'MyPassword'With GRANT OPTION; If it's a fixed IP, write grant all privileges on*. * To'Root'@'192.168.0.49'Identified by'123'with grant option;//push settings to memory or restart the server is also OKMysql>flush Privileges
View Code

MySQL default is not accessible through the remote machine, through the following configuration can be turned on the remote access on the MySQL server side: Execute mysql command into the mysql command mode,1, new user remote connection MySQL database grant all on*. * to [email protected]'%'Identified by'123456'with grant option; flush privileges; Allow any IP address (% = Allow any IP address) for the computer with the admin account and password (123456) to access this MySQL server. Note that the admin account does not have to exist. 2, support for root user allow remote connection to MySQL database grant all privileges on*. * To'Root'@'%'Identified by'123456'With grant Option;flush privileges;//**************/Mysql>Use mysql;mysql> Selecthost,user fromUser;mysql> Update UserSetHost ='%' whereuser ='Root'The error may be prompted after execution. Again MySQL>SelectHost,user fromuser; Root corresponds to the host .%, which means that you can log on with any IP address. mysql>flushprivileges: Flush the cache. After you modify a user record by using the UPDATE statement, the FLUSH statement is required to tell the server to overload the authorization table. So how to access it remotely? Execute commands on another MySQL client (PC with MySQL package, Windows or Linux): SQL code Copy Code collection code MySQL-h172.21.5. in-uadmin-Padmin is ready.//172.21.5.29 is the IP address of MySQL server, admin admin is just the remote access account set up on 172.21.5.29mysql-h172.21.5. in-uadmin-Padmin is ready.//172.21.5.29 is the IP address of MySQL server, admin admin is just the remote access account set up on 172.21.5.29I found a problem if the above command you finished, you are localhost in the local, execute: SQL code mysql-hlocalhost-uadmin-Padmin The result is a failure. Originally above the%It doesn't even include localhost, so you have to add that command, MySQL.>grant all on * * to [email protected]'localhost'Identified by'Admin'With GRANT OPTION;
View Code

MySQL settings allow users to Telnet

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.