mysql 命令行操作入门(详细讲解版)

 


之前分享过多次Mysql主题,今天继续分享mysql命令行入门
 
1.
那么多mysql客户端工具,为何要分享命令行操作?
-快捷、简单、方便
-在没有客户端的情况下怎么办
-如果是mysql未开启第三方访问,客户端就是白瞎
 
2.
如何通过命令行进入mysql
 
--Start--
[root@localhost~]# mysql -u root -p    #老徐注释:输入左侧命令,回车 root是用户名

Enter password:                         #老徐注释:输入密码

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 10

Server version: 5.6.23-log Source distribution

 

Copyright (c) 2000, 2015, 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

--End--

 
 
3. 
如何查看数据库信息
 
--Start--
 

mysql> show databases;   #老徐注释:输入左侧命令,回车

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

+--------------------+

3 rows in set (0.00 sec)

 

mysql>     #老徐注释:如上就是显示当前存在的数据库

 
 
--End--
 
4.
使用某个数据库
查看当天库下有哪些表
 
--Start--
 

mysql> use mysql     #老徐注释:左侧,use 表名,使用某个表

Database changed

mysql> show tables;  #老徐注释:显示当前数据库下的所有表名

+---------------------------+

| Tables_in_mysql           |

+---------------------------+

| columns_priv              |

| db                        |

| event                     |

| func                      |

| general_log               |

| help_category             |

| help_keyword              |

| help_relation             |

| help_topic                |

| innodb_index_stats        |

| innodb_table_stats        |

| ndb_binlog_index          |

| plugin                    |

| proc                      |

| procs_priv                |

| proxies_priv              |

| servers                   |

| slave_master_info         |

| slave_relay_log_info      |

| slave_worker_info         |

| slow_log                  |

| tables_priv               |

| time_zone                 |

| time_zone_leap_second     |

| time_zone_name            |

| time_zone_transition      |

| time_zone_transition_type |

| user                      |

+---------------------------+

28 rows in set (0.00 sec)

 

mysql> 

 
 
--End--
 
5. 
剩下就是很简单的增删改查了
如:
select * from xx  where xx = xx
update xx set xx = xx where xx
delete
insert
等等
具体sql增删改查知识,自行百度,或者买个数据库书好好看
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IDO老徐

转发 + 讨论 > 赞赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值