快速登录MySQL数据库

[root@tdh51 docker]# mysql -h localhost -u transwarp -p$(cat /etc/transwarp-manager/master/db.properties | grep io.transwarp.manager.db.password | awk -F = '{print $2}') -S /var/run/mariadb/transwarp-manager-db.sock
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> DROP DATABASE transwarp_manager;
Query OK, 46 rows affected (0.03 sec)

MariaDB [(none)]> CREATE DATABASE transwarp_manager CHARACTER SET utf8;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> exit
Bye

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[root@tdh01 ~]# cat /etc/transwarp-manager/master/db.properties
io.transwarp.manager.db.driver=com.mysql.jdbc.Driver
io.transwarp.manager.db.url=jdbc:mysql://localhost:3308/transwarp_manager?autoReconnect=true&createDatabaseIfNotExist=false&characterEncoding=UTF-8
io.transwarp.manager.db.user=transwarp
io.transwarp.manager.db.password=kgjOAJQ4Pw
[root@tdh01 ~]# mysql -h localhost -P 3308 -S /var/run/mariadb/transwarp-manager-db.sock -u transwarp -pkgjOAJQ4Pw -D transwarp_manager
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 24
Server version: 5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

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

猜你喜欢

转载自www.cnblogs.com/songyuejie/p/9427222.html