How to open a MySQL remote account

Source: Internet
Author: User
Tags mysql in table name port number firewall

The remote login account that opens MySQL has two big strides:

1, make sure that the firewall on the server does not block 3306 ports.

MySQL default port is 3306, you need to determine that the firewall does not block 3306 ports, or remote can not connect through 3306 ports to MySQL.

If you specified a different port when installing MySQL, open the port number that you specified in MySQL in the firewall.

If you do not know how to set up a firewall on your server, please consult your server administrator.

2, increase allow remote connection MySQL user and authorization.

1 First login to MySQL with root account

Click the Start menu in the Windows host, run, enter "cmd", enter the console, MySQL Bin directory, and then enter the following command.

In the Linux host, enter the following command at the command prompt.

> mysql-uroot-p123456

123456 is the password for the root user.

2 Create a remote login user and authorize

> Grant all privileges on discuz.* to ted@ ' 123.123.123.123 ' identified by ' 123456 ';

The above statement indicates that all permissions to the Discuz database are authorized to the user of Ted, allowing Ted users to remotely log on to the 123.123.123.123 IP and set the TED user's password to 123456.

All of the parameters are analyzed below:

All privileges means giving all permissions to the specified user, which can also be replaced with a specific permission, such as Select,insert,update,delete,create,drop, which is separated by a "," half-width comma.

discuz.* indicates which table the above permissions are for, discuz refers to the database, and the following * means that for all tables, it is possible to infer that all tables for all databases are authorized to be "*.*" and that all tables of a database are authorized to "database name. *", A table for a database is authorized as the database name. Table name.

Ted says which user you want to authorize, this user can be a user who exists, or it can be a non-existent user.

123.123.123.123 represents an IP address that allows remote connections, or "%" if you want to not restrict the link's IP.

123456 is the user's password.

After executing the above statement, the following statement is executed before it can take effect immediately.

> Flush Privileges;

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.