欢迎来到天天文库
浏览记录
ID:34724640
大小:49.36 KB
页数:4页
时间:2019-03-10
《mysql登录、创建数据库和表》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、mysql学习笔记一(mysql登陆)三首先运行——》DOS下;然后开始输入登录命令:1.mysql-u用户名-p eg:mysql-uroot-p 2.回车之后会输出:Enterpassword:输入密码eg:Enterpassword:123 路径将变为:mysql>,说明你已登录成功。 我的登录情况:C:/DocumentsandSettings/FENGJIAN>mysql-uroot-pEnterpassword:***WelcometotheMySQLmonitor. Commandsendwith;or/g.YourMyS
2、QLconnectionidis16Serverversion:5.1.37-communityMySQLCommunityServer(GPL)Type'help;'or'/h'forhelp.Type'/c'toclearthecurrentinputstatement.mysql>mysql学习笔记二(mysql创建数据库和表)一。首先登陆mysql-uroot-penterpassowrd:123 二创建数据库createdatabase数据库名eg:createdatabasenew;注意每句命令后要输入一个";"。 三。指定
3、使用的数据库use数据库名eg:usenew 四。创建表CREATETABLEnewtable( idint(11)NOTNULLAUTO_INCREMENT, namevarchar(20)NOTNULL, PRIMARYKEY(id)
4、 )ENGINE=MYISAMDEFAULTCHARSET=utf8 id和name为字段;AUTO_INCREMENT为自动增长,默认为1;PRIMARYKEY(`id`) 设置id为主键;ENGINE:设置表类型;CHARSET:设置表编码; 具体信息C:/DocumentsandSettings/FENGJIAN>mysql-uroot-pEnterpassword:***WelcometotheMySQLmonitor. Commandsendwith;or/g.YourMySQLconnectionidis17Serve
5、rversion:5.1.37-communityMySQLCommunityServer(GPL)Type'help;'or'/h'forhelp.Type'/c'toclearthecurrentinpumysql>createdatabasenew ->;QueryOK,1rowaffected(0.01sec)mysql>usenewDatabasechangedmysql>CREATETABLEnewtable( ->idint(4)NOTNULLAUTO_INCREMENT, ->namevarchar(20)N
6、OTNULL, ->PRIMARYKEY(id) ->)ENGINE=MyISAMDEFAULTCHARSET=utf8;QueryOK,0rowsaffected(0.00sec)mysql>describenewtable;+-------+-------------+------+-----+---------+----------------+
7、Field
8、Type
9、Null
10、Key
11、Default
12、Extra
13、+-------+-------------+------+-----+---
14、------+----------------+
15、id
16、int(4)
17、NO
18、PRI
19、NULL
20、auto_increment
21、
22、name
23、varchar(20)
24、NO
25、
26、NULL
27、
28、+-------+-------------+------+-----+---------+----------------+2rowsinset(0.00sec)mysql>describenewtable:显示表信息
此文档下载收益归作者所有