Home > Database > Mysql Tutorial > MySQL的一些基本操作_MySQL

MySQL的一些基本操作_MySQL

WBOY
Release: 2016-06-01 13:12:44
Original
1408 people have browsed it

最近开始学习MySQL,主要是通过书籍,和看燕十八老师的视频,然后通过博客记录自己的学习过程。

登入数据库

zhiniaobu@telunsu-K55VD:~$ mysql -uroot -pEnter password:
Copy after login
查看当前所有数据库
mysql> show databases;#查看当前所有数据库+--------------------+| Database |+--------------------+| information_schema || ceshi|| mysql|| performance_schema |+--------------------+4 rows in set (0.04 sec)
Copy after login
创建数据库ceshi1
mysql> create database ceshi1;#创建数据库ceshi1Query OK, 1 row affected (0.00 sec)mysql> show databases;#查看当前所有数据库,会看到现在多了一个ceshi1+--------------------+| Database |+--------------------+| information_schema || ceshi|| ceshi1 || mysql|| performance_schema |+--------------------+5 rows in set (0.00 sec)
Copy after login
查看数据库ceshi1的定义
mysql> show create database ceshi1;#查看数据库ceshi1的定义+----------+-------------------------------------------------------------------+| Database | Create Database |+----------+-------------------------------------------------------------------+| ceshi1 | CREATE DATABASE `ceshi1` /*!40100 DEFAULT CHARACTER SET latin1 */ |+----------+-------------------------------------------------------------------+1 row in set (0.00 sec)
Copy after login
删除数据库ceshi1
mysql> drop database ceshi1;#删除数据库ceshi1Query OK, 0 rows affected (0.07 sec)mysql> show databases;#查看当前所有数据库,现在会发现ceshi1已经不存在了,因为已经删除了+--------------------+| Database |+--------------------+| information_schema || ceshi|| mysql|| performance_schema |+--------------------+4 rows in set (0.00 sec)
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template