Solution to MySQL remote connection failure _ MySQL-mysql tutorial

Source: Internet
Author: User
This article mainly introduces how to solve the problem that MySQL cannot connect remotely. the solution provided in this article is mainly for the case of IP address restrictions. if you need a friend, refer to the remote host, I have enabled the mysql service and can use phpmyadmin to open it. for example, the user name is root and the password is 123456. However, an error is reported during remote connection using the Mysql client. for example, Mysql-Front reports the following error.

Access denied for user ‘root'@'121.42.8.33′(using password:YES)

It is strange that phpmyadmin can be accessed normally, but why cannot Mysql-Front be connected? The possible cause is that the IP address is restricted. phpmyadmin uses localhost for connection, and the IP address of the remote host used only when we access the page, mysql-Front connects to a remote host.

The solution is as follows. we need to create a new user and grant all IP addresses the access permission.

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

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;CREATE USER 'username'@'%' IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION; CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION; CREATE USER 'username'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;

By executing the preceding statements, you can create a new account with username and password, and then log on with the new account.

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.