usql 安装试用体验

1.概述
usql 即universal command-line interface for SQL databases。
功能:
usql provides a simple way to work with SQL and NoSQL databases via a command-line inspired by 
PostgreSQL's psql. usql supports most of the core psql features, such as variables, backticks, 
and commands and has additional features that psql does not, such as syntax highlighting, context-based 
completion, and multiple database support.

Database administrators and developers that would prefer to work with a tool like psql with 
non-PostgreSQL databases, will find usql intuitive, easy-to-use, and a great replacement for 
the command-line clients/tools for other databases.

usql受postgresql的psql的激发,提供简单的方式访问SQL和NoSQL数据库。
usql支持psql的多数核心功能,如变量、反撇号(``即backtick);
此外还要语法高亮、基于上下文自动补齐、多数据库支持的功能。

DBA和开发人员更愿意使用一种工具类似于psql去连接分pg数据库,usql直观、易用,
可以很好的替代其他数据库的客户端工具。

目前支持的数据库常见的有:
oracle
sql server
mysql
postgresql
tidb
cockroachdb
clickhouse等

2.实际操作:

#yum -y install bzip2 tar
# wget https://github.com/xo/usql/releases/download/v0.7.0/usql-0.7.0-linux-amd64.tar.bz2
#tar -xjvf usql-0.7.0-linux-amd64.tar.bz2  -C /usr/bin/
usql

或者使用go包安装:
#yum -y install golang
#go get -u github.com/xo/usql

3.查看usql支持的数据:
# usql
Type "help" for help.

(not connected)=> \drivers
Available Drivers:
  avatica [av, phoenix]
  clickhouse [ch]
  cockroachdb (postgres) [cr, cdb, crdb, cockroach]
  cql [ca, scy, scylla, datastax, cassandra]
  firebirdsql [fb, firebird]
  hdb [sa, sap, hana, saphana]
  memsql (mysql) [me]
  mssql [ms, sqlserver]
  mymysql [zm, mymy]
  mysql [my, maria, aurora, mariadb, percona]
  n1ql [n1, couchbase]
  pgx [px]
  postgres [pg, pgsql, postgresql]
  presto [pr, prs, prestos, prestodb, prestodbs]
  sqlite3 [sq, file, sqlite]
  tidb (mysql) [ti]
  vitess (mysql) [vt]
  voltdb [vo, vdb, volt]
--查看usql的版本信息:
# usql --version
usql 0.7.0


4.usql 登录mysql:
# usql mysql://root:[email protected]:3308
Connected with driver mysql (8.0.12)
Type "help" for help.

my:[email protected]:3308=>
或者:

# usql /tmp/mysql80.sock
error: mysql: 1045: Access denied for user ''@'localhost' (using password: NO)
Enter password: 
Connected with driver mysql (8.0.12)
Type "help" for help.

my+unix:root@/tmp/mysql80.sock=> show databases;
       Database       
+--------------------+
  benchmark           
  emp                 
  hr                  
  information_schema  
  mysql               
  performance_schema  
  sbtest              
  scott               
  sys                 
  tpcds               
  tpch                
  wuhan               
(12 rows)



参考:
https://github.com/xo/usql
其他的支持数据库的情况:
https://github.com/xo/usql

 

你可能感兴趣的:(MySQL,TiDB,CockroachDB)