Remote MySQL login in linux

Source: Internet
Author: User
Tags mysql login

This article mainly introduces the actual solution for implementing remote MySQL login in linux. The specific solution includes the table change method, authorization method, and other related solutions, the following is a detailed description of the article. I hope you will get something after reading it.

1. ALTER TABLE

It may be that your account is not allowed to log on remotely, but only on localhost. At this time, you only need to log in to MySQL on the computer of localhost, and change the "host" entry in the "user" table in the "MySQL" database to "%" from "localhost"

 
 
  1. MySQL -u root -p123  
  2. MySQL>use MySQL;  
  3. MySQL>update user set host = '%' where user = 'root';  
  4. MySQL>select host, user from user; 

2. Authorization Law

For example, if you want kevin to use mypassword to connect to the MySQL server from any host.

 
 
  1. GRANT ALL PRIVILEGES ON *.* TO 'kevin'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 

If you want to allow user kevin to connect to the MySQL server from a host with ip address 192.168.101.234, and use mypassword as the password

 
 
  1. GRANT ALL PRIVILEGES ON *.* TO 'kevin'@'192.168.101.234' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 

3. The last Method

If this is the case, it will not work. (generally, it will work in windows) modify the following configuration file. (in linux, you can find the corresponding configuration file under your MySQL installation directory)

 
 
  1. vi /etc/MySQL/my.cnf 

Comment out

 
 
  1. #bind-address = 127.0.0.1  

The above content is an introduction to MySQL remote login in linux. I hope you will get some benefits.

The above content is a description of MySQL remote login in linux, and I hope it will help you in this regard.

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.