Connect MySQL database via TCP/IP

Source: Internet
Author: User

Problem: MySQL can only connect with localhost or 127.0.0.1

FIX: After MySQL installs, the default is root user, root user can only log on the server, need to assign new user.

1. Log in to the MySQL database as the root user.

2. Execute a command to assign a new user:

Grant all privileges on * * to ' username ' @ ' IP address ' identified by ' password ';

' All privileges ': All permissions can also be written as SELECT, UPDATE, etc.
* * All tables for all libraries, such as databasename.*.
IP where the IP database resides.
Identified by ' Password ' means a password connection.

3. After executing the above command, use the following command to refresh the permissions

Flush privileges;

4. Modify the my.conf configuration

[Mysqld] ... bind_address=127.0.0.1 # shield off the place ...
5. Restart MySQL
5.1. Start: Enter net stop MySQL

5.2. Stop: Enter net start MySQL

Cannot restart (restart) MySQL directly, can only stop, then start.

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.