MySQL remote login settings, mysql Remote Login

Source: Internet
Author: User

MySQL remote login settings, mysql Remote Login

You can access the MySQL of another machine on one machine, but some settings are required.

After entering MySQL, enter the following command:

Grant all privileges on *. * TO 'tigase '@' % 'identified by '000000' with grant option;

Allow any host to use tigase as the user name (root users cannot log on remotely, but only local users can log on), and 123456 as the password to access MySQL.

Flush privileges;

Let MySQL reload the permission so that the granted permission can take effect immediately.


How to enable the mysql remote Logon account

1. Check whether the firewall on the server does not block port 3306.
The default port of MySQL is 3306. Make sure that the firewall does not block port 3306. Otherwise, the remote connection fails.
Port 3306 is connected to MySQL.
If you specify another port when installing MySQL, enable the port used by MySQL in the firewall.
2. Added support for remote connection to MySQL users and authorization.
1) first log on to MySQL with the root account
On a Windows host, click the Start Menu, run, and enter "cmd" to enter the MySQL bin directory on the console.
And then enter the following command.
On the Linux host, enter the following command in the command prompt line.
> MySQL-uroot-p123456
123456 is the password of the root user.
2) create a remote login user and authorize
> Grant all PRIVILEGES on discuz. * to ted @ '2017. 123.123.123 'identified by '123 ';
The preceding statement grants all permissions of the discuz database to the ted user, allowing the ted user
123.123.123.123 remote login, and set the ted user password to 123456.
The following describes all the parameters one by one:
All PRIVILEGES indicates that all permissions are granted to the specified user. Here, you can also replace it with a specific permission,
For example, select, insert, update, delete, create, drop, etc. Separate specific permissions with commas.
Discuz. * indicates the table to which the preceding permissions are for, discuz indicates the database, and * indicates
Some tables can infer that the authorization for all tables in all databases is "*. *".
Table authorization is "database name. *", and a table in a database is authorized as "database name. Table name ".
Ted indicates the user you want to authorize. This user can be an existing user or a non-existing user.
123.123.123.123 indicates the IP address that allows remote connection. If you want to restrict the IP address, set it to "%.
123456 is the user's password.
After the preceding statement is executed, the following statement can take effect immediately.

How to Set MySQL remote connection

Grant all on *. * to 'root' @ '%' identifiied by 'root password' method summary: If you want to connect to your mysql, this error occurs: The reference content is as follows: 1. Change the 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 on to mysql on the localhost computer and change the "host" entry in the "user" table in the "mysql" database, from "localhost" to "%" mysql-u root-pvmwaremysql> use mysql; mysql> update user set host = '%' where user = 'root'; mysql> select host, user from user; 2. authorization method. Grant all privileges on *. * TO 'myuser' @ '%' identified by 'mypassword' with grant option; if you want TO allow myuser TO connect TO the mysql server from a host WITH the ip address 192.168.1.3, and use mypassword as the password grant all privileges on *. * TO 'myuser' @ '192. 168.1.3 'identified BY 'mypassword' with grant option ;?? Common MySQL operation commands

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.