首页 > 数据库技术 > 详细

Create a database in mysql for mac

时间:2017-04-15 11:38:09      阅读:336      评论:0      收藏:0      [点我收藏+]

Before reading the blog, make sure you have succcessfully installed mysql for mac.

Create a database:

  1. login
  2. create a database
  3. create tables
$ mysql -u root -p
$ Enter password: ***
Welcome...
Type help; or \h for help. Type \c to clear the current input statement.
/* view databases */
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| leave_info_system  |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.03 sec)
/* create new database */
mysql> create database testDB;
Query OK, 1 row affected (0.01 sec)
/* If you want to operate at a specific database, you have to change to the db */
mysql> use testDB;
Database changed
/* create new tables in testDB */
mysql> create table testTB(
    -> testNum VARCHAR(16) NOT NULL,
    -> testName VARCHAR(32) NOT NULL,
    -> testDate DATE NOT NULL);
Query OK, 0 rows affected (0.12 sec)
/* view fields in testTB */
mysql> describe testTB;
+----------+-------------+------+-----+---------+-------+
| Field    | Type        | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| testNum  | varchar(16) | NO   |     | NULL    |       |
| testName | varchar(32) | NO   |     | NULL    |       |
| testDate | date        | NO   |     | NULL    |       |
+----------+-------------+------+-----+---------+-------+
3 rows in set (0.01 sec)

 

 

Create a database in mysql for mac

原文:http://www.cnblogs.com/22Kon/p/6713652.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!