明文密码登录
确保mysql服务器开启。
输入命令连接数据库:
mysql -u 用户名 -p密码
⚠️ -p密码 之间没有空格。
示例:
➜ ~ mysql -u root -p201910 mysql: [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 2764 Server 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 its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
⚠️ 明文密码登录的优点是方便,直接使用一条命令就可以直接登录mysql数据库,缺点是安全性差,暴露了密码。
普通登录方式
确保mysql服务器开启。
输入命令连接数据库:
mysql -u root -p

本文介绍了两种登录MySQL数据库的方式:明文密码登录和普通登录。明文密码登录方便但安全性较低,直接通过命令行输入密码;普通登录则需要在命令行输入命令后手动输入密码,相对更安全。
最低0.47元/天 解锁文章
1251

被折叠的 条评论
为什么被折叠?



