mysql快速入门_MySQL
在使用过其它数据库如:oracle,sybase等之后,在使用mysql数据库入门时,一般关心我怎样知道当前的数据库,在数据库里有哪些表,表结构如何?怎样执行一个外部的sql文件等,本文根据sql的资料整理了mysql快速入门的一些信息,希望对了解其他数据库而想转入mysql的入门者有帮助。
1: 显示数据库
SHOW DATABASES,
2:当前选择的数据库,
mysql> SELECT DATABASE();
------------
| DATABASE() |
------------
| test |
------------
3:当前数据库包含的表信息:
mysql> SHOW TABLES;
---------------------
| Tables in test |
---------------------
| mytable1 |
| mytable2 |
---------------------
4:获取表结构
mysql> desc mytable1;
--------- ------------- ------ ----- --------- -------
| Field | Type | Null | Key | Default | Extra |
--------- ------------- ------ ----- --------- -------
| s1 | varchar(20) | YES | | NULL | |
--------- ------------- ------ ----- --------- -------
5:执行外部的sql脚本
shell> mysql
在当前数据库上执行input.sql
或
shell> mysql test
在test数据库上执行input.sql
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Huawei is rolling out software version 5.0.0.100(C00M01) for the Watch GT 5 and the Watch GT 5 Prosmartwatchesglobally. These two smartwatches recently launched in Europe, with the standard model arriving as the company’s cheapest model. This Harmony

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

The page is blank after PHP connects to MySQL, and the reason why die() function fails. When learning the connection between PHP and MySQL database, you often encounter some confusing things...

PHP...

Many website developers face the problem of integrating Node.js or Python services under the LAMP architecture: the existing LAMP (Linux Apache MySQL PHP) architecture website needs...

How to share the same page on the PC and mobile side and handle cache issues? In the nginx php mysql environment built using the Baota background, how to make the PC side and...

Detailed explanation of the problem of deducting balances in combination with PHP optimistic locks and transactions in this article will analyze in detail a balance deduction using PHP, optimistic locks and database transactions, only...

Effective monitoring of Redis databases is essential for maintaining optimal performance, identifying potential bottlenecks, and ensuring overall system reliability. Redis Exporter Service is a robust utility designed to monitor Redis databases using Prometheus. This tutorial will guide you through the complete setup and configuration of Redis Exporter Service, ensuring you establish a monitoring solution seamlessly. By following this tutorial, you’ll achieve a fully operational monitoring setup to effectively monitor the performance metrics of your Redis database.
