win10中用命令行打开服务
services.msc
命令行关闭mysql服务:net stop mysql
命令行启动mysql服务:net start mysql
c creat
r retrieve
u update
d delete
1.查看所有数据库的名称:show databases;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| 2222 |
| audi |
| baoquan |
| fuaokongtiao |
| mysql |
| office |
| performance_schema |
| test |
+--------------------+
9 rows in set (0.01 sec)
2.查看对应的(mysql)数据库的字符集:show creat database mysql;
mysql> show create database test;
+----------+-----------------------------------------------------------------+
| Database | Create Database |
+----------+-----------------------------------------------------------------+
| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+-----------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show create database baoquan;
+----------+------------------------------------------------------------------+
| Database | Create Database |
+----------+------------------------------------------------------------------+
| baoquan | CREATE DATABASE `baoquan` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show create database mysql;
+----------+------------------------------------------------------------------+
| Database | Create Database |
+----------+------------------------------------------------------------------+
| mysql | CREATE DATABASE `mysql` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+------------------------------------------------------------------+
1 row in set (0.00 sec)
3.创建数据库db1 如果不存在的话;
mysql> create database if not exists db1;
Query OK, 1 row affected, 1 warning (0.00 sec)
4.用指定字符集创建数据库db2;
mysql> create database if not exists db1;
Query OK, 1 row affected, 1 warning (0.00 sec)
5.查看新创建的db2 使用的是哪种字符集(gbk)
mysql> show create database db2;
+----------+-------------------------------------------