学习目标:
1.一个月学会MySQL的基本操作
2.完成第1个目标
Mac MySQL的基本操作(命令):
1、 连接MySQL数据库
首先打开终端,输入:
/usr/local/MySQL/bin/mysql -u root -p
会出现输入密码的界面:输入密码(不考虑密码忘了的情况)
Enter password:
出现下面代码,MySQL连接成功
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 24
Server version: 8.0.22 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>
2、 查看MySQL有哪些数据库
输入:记住分号是英文!!
mysql> show databases;
显示如下:默认有四个数据库(Logistics 是我自己的数据库,不用管)
+--------------------+
| Database |
+--------------------+
| information_schema |
| Logistics