首页> 基础笔记 >Mysql基础学习 Mysql基础学习
MySQL数据库的常见操作 数据库的连接与关闭
作者:小萝卜 2019-08-18 【 MySql 数据库 】 浏览 1176
简介MySQL数据库的常见操作,MySQL数据库的连接与关闭:mysql –h 服务器主机地址 –u 用户名 –p 用户密码
MySQL数据库的常见操作 数据库的连接与关闭
MySQL数据库的连接与关闭:
mysql –h 服务器主机地址 –u 用户名 –p 用户密码
只有客户机所在的主机被授予权限才能去连接MySQL服务器。
注意:
1.每个SQL命令都需要使用分号来完成
2.可以将一行命令拆成多行
3.可以通过\c来取消本行命令
4.可以通过\q、exit、ctrl+c或者quit来退出当前客户端
我们可以使用help命令来查询快捷键:
将查询后的数据立起来:\G
取消当前未完成的操作:\c
退出当前客户端:\q
显示当前服务器状态:\s
显示帮助信息:\h(同help命令)
更改执行符:\d
D:\>
-- 连接MySQL数据库服务器
D:\>mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.25a MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
很赞哦! (0)