hellopasswd
连接MySQL
- mysql -uroot -p123
- mysql -uroot -p123 -h127.0.0.1 -P3306
- mysql -uroot -p123 -S/tmp/mysql.sock
- mysql -uroot -p123 -e "show databases"
使用本地ip指定端口连接mysql
[root@localhost ~]# /usr/local/mysql/bin/mysql -uroot -p123 -h127.0.0.1 -P3306Warning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.36 MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> quitBye
使用socket协议连接mysql
[root@localhost ~]# /usr/local/mysql/bin/mysql -uroot -p123 -S/tmp/mysql.sockWarning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.6.36 MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> quitBye
查看mysql库
[root@localhost ~]# /usr/local/mysql/bin/mysql -uroot -p123 -e "show databases"Warning: Using a password on the command line interface can be insecure.+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || test |+--------------------+
用于监控mysql连接数
修改于 180112