本文共 1202 字,大约阅读时间需要 4 分钟。
确保mysql服务器开启。
输入命令连接数据库:
mysql -u 用户名 -p密码
⚠️ -p密码 之间没有空格。
示例:
➜ ~ mysql -u root -p201910mysql: [Warning] 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 2764Server version: 5.7.21 MySQL Community Server (GPL)Copyright (c) 2000, 2018, 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>
⚠️ 明文密码登录的优点是方便,直接使用一条命令就可以直接登录mysql数据库,缺点是安全性差,暴露了密码。
确保mysql服务器开启。
输入命令连接数据库:
mysql -u root -p
接下来mysql提示输入登录密码。
➜ ~ mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2765Server version: 5.7.21 MySQL Community Server (GPL)Copyright (c) 2000, 2018, 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>
转载地址:http://dfsoi.baihongyu.com/