Get the App
SLTechnology News&Howtos  ›  Database  › 

Execute mysql commands without logging in to the database

Shulou Source: shulou.com Published: 2022-06-01 17:01:52 10月01日 Update

1. Implemented through echo (this is more common)

Echo "show databases;" | mysql-uroot-pqwe123-S / data/3307/mysql.sock

Tip: this method is suitable for situations where there are few single-line strings.

two。 Realized by mysql-e parameter

Mysql-u root-pqwe123-S / data1/3307/mysql.sock-e "show databases;"

3. Implemented through cat (this method is not used much)

Cat | mysql-uroot-pqwe123-S / data/3307/mysql.sock

Tags: Statement content prompt difficulty character string command data database login special needle in a haystack master-slave writing parameters scene sea common situation time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL vpn Redmi Linux Apple