Mysql allows remote login configuration

Source: Internet
Author: User

Mysql allows remote login configuration
Mysql-h 10.17.11.187-uroot-ploushang
To enable remote logon, follow these steps:
1. log on to Mysql-Server to connect to local mysql (only local connections are allowed by default)
2. Modify the user configuration of Mysql-Server.
Mysql> USE mysql; -- switch to mysql DB
Database changed
Mysql> SELECT User, Password, Host FROM user; -- view existing users, passwords, and hosts allowed to be connected
+ ------ + ---------- + ----------- +
| User | Password | Host |
+ ------ + ---------- + ----------- +
| Root | localhost |
+ ------ + ---------- + ----------- +
1 row in set (0.00 sec)
Mysql> -- only one default root user. The password is blank and only localhost connection is allowed.
Mysql> -- Next we will add another root user. The password is blank and only 192.168.1.100 connections are allowed.
Mysql> grant all privileges on *. * TO 'root' @ '192. 168.1.100 'identified by' 'with grant option;
Mysql> -- @ '2017. 168.1.100' can be replaced with @ '%' to access any ip address. Of course, we can also directly UPDATE the root user Host with UPDATE, but it is not recommended. The SQL is as follows:
Mysql> -- UPDATE user SET Host = '192. 168.1.100 'WHERE User = 'root' AND Host = 'localhost' LIMIT 1;
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Change root Password
Mysql> use mysql

Database changed

Mysql> update user set password = PASSWORD ('000000') where user = 'root ';

Query OK, 0 rows affected (0.00 sec)

Rows matched: 1 Changed: 0 Warnings: 0

Mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

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.