Mysql remote connection using myeclipse

Source: Internet
Author: User
2. Set the user and password to allow the specified IP address to access: mysql-uroot-p or install the shortcut: MySQLCommandLineClient. Run grant command: grant permission 1, permission 2, permission non database name. table name to user name @ user address identifiedby connection password; example: mysqlgrantselect, insert, upda

2. Set the user and password to allow the specified IP address to access: mysql-u root-p or install the shortcut to enter: MySQL Command Line Client, and use the grant Command: grant permission 1, permission 2, permission n on Database Name. table name to user name @ user address identified by 'Connection password'; example: mysqlgrant select, insert, upda

2. Set the user and password to allow the specified IP address to access: mysql-u root-p or install the shortcut to MySQL Command Line Client. Run the grant Command:

Grant permission 1, permission 2 ,... Permission n on database name. Table name to user name @ user address identified by 'Connection password ';

Example:

Mysql> grant select, insert, update, delete, create, drop on mydb. mytable to lzpddd@192.168.1.88 identified by 'mypassword ';

Assign select, insert, update, delete, create, and drop permissions to mytable tables in mydb to users from 192.168.1.88, and set the password to 'mypassword ';

Mysql> grant all privileges on *. * to lzpddd@192.168.1.88 identified by 'mypassword ';

Assign permissions to user lzpddd from 192.168.1.88 for all operations on all tables in all databases, and set the password to 'mypassword ';

Mysql> grant all privileges on *. * to lzpddd @ '%' identified by 'mypassword ';

Assign the user lzpddd from any IP address the permission limit for all operations on all tables in all databases, and set the password to 'mypassword ';

3. Disable the server firewall or open port 3306 (important );

4. Client connection:

Go to the command line, windows cmd, and connect:

Mysql-u username-p password-h Server IP address-P server MySQL port number-D database name

Note:

(1) The server port flag-P must be larger to distinguish it from the user-p. If you directly connect to the database, the logo-D must also be capitalized;

(2) If you want to directly enter the password-p, there cannot be spaces such as-pmypassword;

(3) The command end segment does not have a semicolon.

Example:

Mysql-u lzpddd-pmypassword-h 192.168.1.88-P 3306-D mydb

1. Configure the web service on web server. Assume that the IP address of the web server is 192.192.192.192.

2. Install the mysql service on Database Server B.

3. Currently, new mysql versions do not allow remote connection by default. You must create a remote connection account.
Use the root account to access mysql using the command line.
Mysql-uroot-ppass

Select to enter the mysql database
Use 'mysql ';

View all existing accounts and addresses.
SELECT 'host', 'user' FROM 'user ';

For example, mine is:

+ ----------- + ------ +
| Host | User |
+ ----------- + ------ +
| Localhost |
| Localhost | pma |
| Localhost | root |
+ ----------- + ------ +

3 rows in set (0.00 sec)

That is to say, there are three (localhost) accounts that only allow local connections, namely root, pma, and empty users.

Now, the root user has the permission to remotely connect to the web server.

UPDATE 'user' SET 'host' = '192.192.192 'where 'user' = 'root' LIMIT 1;

In this way, the web server 192.192.192.192 can be remotely connected to the database server. If you want any remote machine to connect to the database, replace 192.192.192.192 with %. However, this is not recommended!

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.