Lamp Build 21:mysql Local login and Telnet

Source: Internet
Author: User
Tags reserved

Local login uses the MySQL command directly, the-u option specifies the user name, and the-p option specifies the user password

[Email protected] ~]# mysql-uroot-p123456

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 2

Server version:5.1.49 MySQL Community Server (GPL)

Copyright (c), Oracle and/or its affiliates. All rights reserved.

This software comes with absolutely NO WARRANTY. This is the free software,

And you is welcome to modify and redistribute it under the GPL v2 license

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

Telnet MySQL requires the-H option to specify the host, the-p option specifies the port, by default 127.0.0.1 is authorized to Telnet:

[Email protected] ~]# mysql-uroot-h127.0.0.1-p3306-p123456

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 3

Server version:5.1.49 MySQL Community Server (GPL)

Copyright (c), Oracle and/or its affiliates. All rights reserved.

This software comes with absolutely NO WARRANTY. This is the free software,

And you is welcome to modify and redistribute it under the GPL v2 license

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

Users who are not authorized by default cannot log on:

[Email protected] ~]# mysql-uroot-h192.168.147.132-p3306-p123456

ERROR 1130 (HY000): Host ' 192.168.147.132 ' isn't allowed to connect to this MySQL server

Authorize a user to telnet to MySQL, where the IP is the client IP

mysql> use MySQL;

Mysql> Grant All on * * to ' root ' @ ' 192.168.147.132 ' identified by ' 123456 ';

Query OK, 0 rows affected (0.01 sec)

View information about the host 192.168.11.160 user

Mysql> SELECT * from user where host= ' 192.168.147.132 ' \g;

1. Row ***************************

host:192.168.147.132

User:root

Password: *6bb4837eb74329105ee4568dda7dc67ed2ca2ad9

Select_priv:y

Insert_priv:y

Update_priv:y

Delete_priv:y

Create_priv:y

Drop_priv:y

Reload_priv:y

Shutdown_priv:y

Process_priv:y

File_priv:y

Grant_priv:n

References_priv:y

Index_priv:y

Alter_priv:y

Show_db_priv:y

Super_priv:y

Create_tmp_table_priv:y

Lock_tables_priv:y

Execute_priv:y

Repl_slave_priv:y

Repl_client_priv:y

Create_view_priv:y

Show_view_priv:y

Create_routine_priv:y

Alter_routine_priv:y

Create_user_priv:y

Event_priv:y

Trigger_priv:y

Ssl_type:

Ssl_cipher:

X509_issuer:

X509_subject:

max_questions:0

max_updates:0

max_connections:0

max_user_connections:0

1 row in Set (0.00 sec)

ERROR:

No query specified

You can log in remotely after authorization is successful

[Email protected] ~]# mysql-uroot-h192.168.147.132-p3306-p123456

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 6

Server version:5.1.49 MySQL Community Server (GPL)

Copyright (c), Oracle and/or its affiliates. All rights reserved.

This software comes with absolutely NO WARRANTY. This is the free software,

And you is welcome to modify and redistribute it under the GPL v2 license

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

See who is currently logged in to the user

Mysql> Select User ();

+----------------------+

| User () |

+----------------------+

| [Email protected] |

+----------------------+

1 row in Set (0.00 sec)

If 127.0.0.1 is logged in:

Mysql> Select User ();

+----------------+

| User () |

+----------------+

| [Email protected] |

+----------------+

1 row in Set (0.00 sec)

If there is more than one MySQL locally, you can use the-s option to specify the socket and log in to the appropriate MySQL

[Email protected] ~]# mysql-uroot-s/tmp/mysql.sock-p123456

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 8

Server version:5.1.49 MySQL Community Server (GPL)

Copyright (c), Oracle and/or its affiliates. All rights reserved.

This software comes with absolutely NO WARRANTY. This is the free software,

And you is welcome to modify and redistribute it under the GPL v2 license

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>


Lamp Build 21:mysql Local login and Telnet

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.