MySQL学习记录1

时间:2020-03-27
本文章向大家介绍MySQL学习记录1,主要包括MySQL学习记录1使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
C:\Users\Administrator>mysql -u root -proot  #進入MySQL  ,另外 -p 回車再輸入密碼,就會隱藏密碼



mysql> #查庫
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| challenges         |
| liweigan           |
| ly                 |
| mysql              |
| performance_schema |
| security           |
| test               |
+--------------------+
8 rows in set (0.00 sec)

mysql> #要使用一個庫才能查表
mysql> #使用庫
mysql> use security;
Database changed
mysql> #查表
mysql> show tables;
+--------------------+
| Tables_in_security |
+--------------------+
| emails             |
| referers           |
| uagents            |
| users              |
+--------------------+
4 rows in set (0.00 sec)

mysql> #查表的結構
mysql> desc users;
+----------+-------------+------+-----+---------+----------------+
| Field    | Type        | Null | Key | Default | Extra          |
+----------+-------------+------+-----+---------+----------------+
| id       | int(3)      | NO   | PRI | NULL    | auto_increment |
| username | varchar(20) | NO   |     | NULL    |                |
| password | varchar(20) | NO   |     | NULL    |                |
+----------+-------------+------+-----+---------+----------------+
3 rows in set (0.02 sec)


#查当前使用的库用函数
database()
#查看当前使用的用户
user()

原文地址:https://www.cnblogs.com/cat2020/p/12582762.html