Native setting up a remote database connection

Source: Internet
Author: User

Tagged with: localhost IP address update database wildcard


2, after the computer log in MySQL, the "MySQL" Database in the "User" table "host", from "localhost" to the '% '.
The code is as follows:
Mysql>
Mysql>use MySQL;
Mysql>select host from user where user= ' root ';


Mysql>update User Set host = '% ' where user = ' root ';
Modify the host value (add the hostname/IP address as the wildcard%), or you can add a specific one directly, if error 1062 (23000) occurs when you execute the UPDATE statement: Duplicate entry '%-root ' for key ' PRIMARY ' ERROR, requires select host from user where user = ' root ';
Check to see if the host has a% value, and if so, directly execute the following flush privileges;
The code is as follows

Mysql>flush privileges;
Mysql>select host,user from user where user= ' root ';
Mysql>quit


3.
ERROR 1044 (42000): Access denied for user "@ ' localhost ' to database ' MySQL '


1. Turn off MySQL
# Service Mysqld Stop
2. Blocking permissions
# Mysqld_safe--skip-grant-table
Screen appears: Starting demo from .....
3. Start a new terminal input
# mysql-u Root MySQL
mysql> Delete from user where user= ';
Mysql> FLUSH privileges;//Remember to say this, otherwise if you close the previous terminal, the original error will appear
Mysql> \q

Native setting up a remote database connection

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.