Ways to fix Mysql's inability to connect remotely _mysql

Source: Internet
Author: User
Tags mysql client mysql command line phpmyadmin

MySQL remote connection cannot open solution


1, Change Table method .

Please use MySQL management tools, such as: SQLyog Enterprise, navicate MySQL

Your account may not be allowed to log in remotely, only in localhost. This time, as long as the computer in localhost using MySQL management tools login MySQL, change the "MySQL" Database in the "User" table in the "host" item, from "localhost" renamed "%"


2. The law of authorization.

A: You want to MySQL account myuser use password mypassword from any host to connect to the MySQL server, then the MySQL command line to enter:
Grant all privileges in *.* to ' myuser ' @ '% ' identified by ' MyPassword ' with GRANT OPTION;

If the above command has not worked, then use the following command, must be successful!

If you want to allow the MySQL account myuser to connect to the MySQL server from the IP-192.168.1.3 host and use MyPassword as the password, enter at the MySQL command line:

Grant all privileges in *.* to ' myuser ' @ ' 192.168.1.3 ' identified by ' MyPassword ' with GRANT OPTION;

This is supplemented by other netizens:

On the remote host, I opened the MySQL service, with phpMyAdmin can be opened, such as user name is root, password is 123456. However, the remote connection with the Mysql client, but reported errors, such as Mysql-front reported the following error.

Access denied for user ' root ' @ ' 121.42.8.33′ (using Password:yes)

Strange, phpMyAdmin can be normal access, and mysql-front why can not connect it? Possible reasons, should be the IP limit, phpmyadmin in connection with the localhost, and we access the page to use the remote host IP, while the mysql-front connected to the remote host.

The workaround is as follows: We need to create a new user, and then grant all IP access to the right.

In the following SQL statement, username is the username, password the password you want to set:

CREATE USER ' username ' @ ' localhost ' identified by ' password ';

Grant all privileges in *.* to ' username ' @ ' localhost ' with GRANT OPTION;

CREATE USER ' username ' @ '% ' identified by ' password ';

Grant all privileges in *.* to ' username ' @ '% ' with GRANT OPTION;
 
CREATE USER ' username ' @ ' localhost ' identified by ' password ';
 
Grant all privileges in *.* to ' username ' @ ' localhost ' with GRANT OPTION;
 
CREATE USER ' username ' @ '% ' identified by ' password ';
 
Grant all privileges in *.* to ' username ' @ '% ' with GRANT OPTION;

By executing the above statement, you create a new account with a username of username, a password of password, and then log in with a new account to connect successfully.

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.