mysql操作手册我_MySQL使用指南一

我将MySQL常用指令整理出来分享给大家。

1. 列出所有数据库

mysql> show databases;

0818b9ca8b590ca3270a3433284dd417.png

2. 创建数据库

mysql> create databases MyStorage;

0818b9ca8b590ca3270a3433284dd417.png

3. 打开数据库

mysql> use MyStorage;

0818b9ca8b590ca3270a3433284dd417.png

4. 创建表

mysql> create table Storage

-> (

-> id int,

-> name varchar(50),

-> price float,

-> type nvarchar(50),

-> number int,

-> makeTime date,

-> useDay int);

0818b9ca8b590ca3270a3433284dd417.png

5. 显示所有的表

mysql> show tables;

0818b9ca8b590ca3270a3433284dd417.png

6. 显示表详细信息

mysql> describe storage;

0818b9ca8b590ca3270a3433284dd417.png

7. 将文本文件sotrage.txt中的记录导入到表中

mysql> load data local infile 'e:/storage.txt' into table storage

-> lines terminated by '/r/n';

0818b9ca8b590ca3270a3433284dd417.png

8. 显示表中的记录

mysql> SELECT * FROM storage;

0818b9ca8b590ca3270a3433284dd417.png

9. 向表中插入记录

mysql> insert into storage

-> values (8,'风衣',300,'服装',3650,'2011-3-1',0);

0818b9ca8b590ca3270a3433284dd417.png

10. 删除表中的记录

mysql> delete from storage where id=8;

0818b9ca8b590ca3270a3433284dd417.png

11. 修改表中的记录

mysql> update storage set price=1000 where id=7;

0818b9ca8b590ca3270a3433284dd417.png

12. 显示mysql中所有账户

mysql> show databases;

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

| Database           |

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

| information_schema |

| mysql              |

| mystorage          |

| test               |

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

4 rows in set (0.00 sec)

mysql> use mysql;

Database changed

mysql> show tables;

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

| Tables_in_mysql           |

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

| columns_priv              |

| db                        |

| func                      |

| help_category             |

| help_keyword              |

| help_relation             |

| help_topic                |

| host                      |

| proc                      |

| procs_priv                |

| tables_priv               |

| time_zone                 |

| time_zone_leap_second     |

| time_zone_name            |

| time_zone_transition      |

| time_zone_transition_type |

| user                      |

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

17 rows in set (0.00 sec)

mysql> select * from user;+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+| Host      | User | Password                                  | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv| ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections |+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+| localhost | root | *23AE809DDACAF96AF0FD78ED04B6A265E05AA257 | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y      | Y          | Y            | Y          | Y                     | Y          | Y            | Y               | Y                | Y | Y              | Y                   | Y                  | Y|          |            |             |              |             0 | 0 |               0 |                    0 |+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+1 row in set (0.00 sec)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/279143.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

谷歌地图将很快显示电动汽车充电站

If you’re out on the road in the future and find your electric vehicle is in dire need of a charge, you’ll soon be able to look to Google Maps for help finding a charging station. 如果您将来出门在外,并且发现您的电动汽车急需充电,那么…

JS4

1. js的本质就是处理数据。数据来自于后台的数据库。 所以变量就起到一个临时存储数据的作用。 ECMAScript制定了js的数据类型。 数据类型有哪些? 字符串 String数字 Number布尔 BooleanNull 空Undefined Object 对象Array 数组 json function …

松弛变量可以为负吗_如何为松弛安装(非官方)暗模式

松弛变量可以为负吗Slack still doesn’t have a dark mode. They have dark themes, but those only let you customize the sidebar colors, leaving the main window white. With the release of system-wide dark modes on macOS Mojave and Windows 10, Slack feels very …

如何在Mac上设置FaceTime

FaceTime is Apple’s built-in video and audio calling app. It pairs with your iPhone and allows you to make phone calls on macOS. FaceTime是Apple的内置视频和音频通话应用程序。 它可以与iPhone配对使用,并允许您在macOS上拨打电话。 You don’t need an…

在Ubuntu 11.10中将窗口按钮移回右侧

As of Ubuntu 10.04, the minimize, maximize, and close buttons on all windows were moved to the left side and the system menu was removed. Prior to version 11.10, you could use several methods to restore the original button arrangement. 从Ubuntu 10.04开始&a…

如何在Windows 10上使用触摸板手势

If you’ve used a touchpad in Windows 10, you’re no doubt aware of the basic single-finger tapping and two-finger scrolling gestures. Windows 10 also packs in some additional gestures you might not have tried. 如果您在Windows 10中使用了触摸板,那…

相机模拟光圈_我的相机应该使用什么光圈?

相机模拟光圈Aperture, along with shutter speed and ISO, is one of the three most important settings you control when you take a photo. It affects both the amount of light that hits your camera sensor and the depth of field of your images. Let’s look at ho…

2018-2019-1 20165234 《信息安全系统设计基础》第四周学习总结

一、学习目标 了解ISA抽象的作用 掌握ISA,并能举一反三学习其他体系结构 了解流水线和实现方式二、学习内容 Y86-64指令 movq指令 irmovq rrmovq mrmovq rmmovq四个整数操指令 addq,subq,andq,xorq只对寄存器数据进行操作7个跳转指令 cmovle cmovl cmove cmovne cmo…

Python之钉钉机器人推送天气预报

通过Python脚本结合钉钉机器人,定时向钉钉群推送天气预报 #!/usr/bin/python # -*- coding: utf-8 -*- # Author: aikergdedu.ml # My blog http://m51cto.51cto.blog.com import requests import re import urllib2 import json import sys import osheaders {Co…

google +按钮_如何禁用或改善Google的Google+集成

google 按钮If you’ve used Google lately, you’ve probably seen Google taking over Google’s search results. You don’t have to put up with it — you can disable the integration, show better social-networking pages or hide those pesky Google notifications.…

java 集合读写同步_JAVA多线程学习十六 - 同步集合类的应用

1.引言在多线程的环境中,如果想要使用容器类,就需要注意所使用的容器类是否是线程安全的。在最早开始,人们一般都在使用同步容器(Vector,HashTable),其基本的原理,就是针对容器的每一个操作,都添加synchronized来进行同…

ubuntu自定义菜单_如何自定义Ubuntu的每日消息

ubuntu自定义菜单Ubuntu displays an informative message, known as the message of the day, when a user logs in at the terminal. The MOTD is fully customizable — you can add your own text and other dynamic data. 当用户在终端上登录时,Ubuntu将显示信…

火狐web开发清楚缓存_如何使用Firefox的Web开发工具

火狐web开发清楚缓存Firefox’s Web Developer menu contains tools for inspecting pages, executing arbitrary JavaScript code, and viewing HTTP requests and other messages. Firefox 10 added an all-new Inspector tool and updated Scratchpad. Firefox的Web Develop…

Java基类共同属性设置_多选择基类的访问属性-Java初学笔记

多选择基类的访问属性你现在知道在定义类的访间属性时可用的选择项,你希望使用这些类定义子类。你知道在类继承上这些属性所具有的效果,但是你如何决定到底应该使用哪一个呢?这里没有死板和现成的规则,你选择的访问属性取决于在将来你想用类…

IT:如何在Windows Server 2008 R2上安装Hyper-V虚拟化

Windows Server 2008 R2 and later releases of the product ship with a virtualization platform called Hyper-V, which works quite well since it’s built into Windows. Today we’re going to show you how to install it. Windows Server 2008 R2和更高版本的产品附带…

FineReport单行与数据库交互的方法

1. 问题描述 我们在做一张报表填报的时候经常会遇到需要在一行进行添加动作,将该行数据直接与数据库交互,执行存储过程过程。我们可以通过每一行增加帆软“插入”按钮实现插入动作,并且在控件事件中增加和数据库的交互,但当事件…

java cas volatile_每日一个知识点:Volatile 和 CAS 的弊端之总线风暴

每日一个知识点系列的目的是针对某一个知识点进行概括性总结,可在一分钟内完成知识点的阅读理解,此处不涉及详细的原理性解读。一、什么是总线风暴总线风暴,听着真是一个帅气的词语,但如果发生在你的系统上那就不是很美丽了&#…

SqlServer之代码块相关

转载必需注明出处:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/sqlserver-codeblock/ 一、go语句 Go语句是SqlServer中用来表示当前代码块结束提交并确认结果的语句。 Go语句不能和其他Sql命令卸载同一行上! 定义的局部变量作用域局限在定义它的代码…

010 使用list和tuple

list Python内置的一种数据类型是列表:list。list是一种有序的集合,可以随时添加和删除其中的元素。 比如,列出班里所有同学的名字,就可以用一个list表示: >>> classmates [Michael, Bob, Tracy] >>&g…

IT:如何使用Server 2008 R2上的远程桌面服务设置自己的终端服务器

In today’s IT learning article, we are going to take a look at installing Terminal Services, otherwise known as Remote Desktop Services, on a Server 2008 R2 machine. 在今天的IT学习文章中,我们将介绍在Server 2008 R2计算机上安装终端服务(也称为远程…