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()

 

posted @ 2020-03-27 17:32  cat2020  阅读(139)  评论(0)    收藏  举报