标签:info 有关 rac 查看 man 创建 alter nes warnings
摘要:本文主要学习了使用DDL语句对数据库进行操作的方法。
1 create database [if not exists] 数据库名 2 [default] character set 字符集名 3 [default] collate 校对规则名;
1 mysql> create database if not exists demo 2 -> default character set utf8 3 -> default collate utf8_general_ci; 4 Query OK, 1 row affected (0.00 sec) 5 6 mysql>
1 show create database demo;
1 show databases;
1 mysql> show databases; 2 +--------------------+ 3 | Database | 4 +--------------------+ 5 | information_schema | 6 | demo | 7 | mysql | 8 | performance_schema | 9 +--------------------+ 10 4 rows in set (0.00 sec) 11 12 mysql>
1 use demo;
1 mysql> use demo; 2 Database changed 3 mysql>
1 alter database 数据库名 2 [default] character set 字符集名 3 [default] collate 校对规则名;
1 mysql> show create database demo; 2 +----------+---------------------------------------------------------------+ 3 | Database | Create Database | 4 +----------+---------------------------------------------------------------+ 5 | demo | CREATE DATABASE `demo` /*!40100 DEFAULT CHARACTER SET utf8 */ | 6 +----------+---------------------------------------------------------------+ 7 1 row in set (0.00 sec) 8 9 mysql> alter database demo 10 -> character set gb2312 11 -> collate gb2312_chinese_ci; 12 Query OK, 1 row affected (0.00 sec) 13 14 mysql> show create database demo; 15 +----------+-----------------------------------------------------------------+ 16 | Database | Create Database | 17 +----------+-----------------------------------------------------------------+ 18 | demo | CREATE DATABASE `demo` /*!40100 DEFAULT CHARACTER SET gb2312 */ | 19 +----------+-----------------------------------------------------------------+ 20 1 row in set (0.00 sec) 21 22 mysql>
1 drop database [if exists] 数据库名;
1 mysql> drop database demo; 2 Query OK, 0 rows affected, 2 warnings (0.00 sec) 3 4 mysql>
标签:info 有关 rac 查看 man 创建 alter nes warnings
原文地址:https://www.cnblogs.com/shamao/p/11451613.html