MySQL登录退出
阅读:457前面讲解了数据库的基本概念,现在正式进入SQL的讲解。本教程以MySQL为例讲解SQL,MySQL是现在互联网公司应用最广泛的关系型数据库。MySQL安装过程这里就不做讲解了,可以根据自己的操作系统不同,选择相应的版本下载。
1. MySQL登录退出
1.1 登录MySQL
打开终端,输入如下命令:
mysql -hlocalhost -uroot -p
提示输入密码:
Enter password:
输入密码后,终端输出如下内容:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.30 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, 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 -hlocalhost -uroot -p,其中:
- -h主机名
- -u用户名
- -p密码,当然-p后可以直接跟上密码,但是不建议这么做,因为密码容易被别人看到,直接回车后,会让输入密码。
- -P(端口)
- 单字母用-,多字母用--,注意没有空格。
1.2 MySQL退出登录
通过如下命令均可退出客户端登录。
- quit
- exit
- \q
赞赏支持
