Use trusted CT password-free to enter MySQL command mode

Source: Internet
Author: User
In general, we want to enter the MySQL command mode always need to follow the following interactive input password confirmation, in order to enter the command line mode: zhanhailiang @ linux-06bq :~ Mysql-usl-pEnterpassword

In general, we want to enter the MySQL command mode always need to follow the following interactive input password confirmation, in order to enter the command line mode: zhanhailiang @ linux-06bq :~ Mysql-u sl-p Enter password: in fact, we can use reverse CT to write scripts to allow communications between reverse CT and shell to achieve password-free Logon: zhanhailia

In general, to enter the MySQL command mode, you always need to enter the password as follows to enter the command line mode:

Zhanhailiang @ linux-06bq: ~> Mysql-u sl-p

Enter password:

In fact, we can use reverse CT to write scripts to allow communications between reverse CT and shell to achieve password-free login:

Zhanhailiang @ linux-06bq: ~> Cat mysql. sh

#! /Usr/local/bin/CT

Spawn/usr/local/services/mysql/bin/mysql-u sl-p

CT {

"Assword" {send "slr "}

}

Interact

In fact, this script means "execute/usr/local/services/mysql/bin/mysql-u sl-p and wait for the response. If it matches assword, then, send the sl (MySQL user logon password), press enter, and simulate manual operation ".

After writing the mysql. sh script, grant the execution permission, and then run mysql. sh to enter the MySQL command line mode without a password.

Zhanhailiang @ linux-06bq: ~> Chmod + x mysql. sh

Zhanhailiang @ linux-06bq: ~> ./Mysql. sh

Spawn/usr/local/services/mysql/bin/mysql-u sl-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or g.

Your MySQL connection id is 12912

Server version: 5.5.14-log MySQL Community Server (GPL)

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

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help; 'or 'H' for help. Type 'C' to clear the current input statement.

Mysql>

Note: Regular CT has many parameters and rich application scenarios. If you are interested, please check the man manual or other materials on your own.

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.