MySQL数据库的学习(一)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhang_09_11/article/details/80571610
MySQL使用的版本是5.6.40 MySQL Community Server(GPL)
在cmd命令行的一些操作命令:
开启
c:\Windows\system32>net start mysql
停止
c:\Windows\system32>net stop mysql


登录
c:\Windows\system32>mysql -uroot -p
输入密码登录
or
c:\Windows\system32>mysql -u用户名 -p密码 -P端口名称 -h服务器地址
(-uroot, -p密码, -P默认端口3306,-h本地地址127.0.0.1)
退出
mysql>\q

(注意:mysql语句结尾要有分号)


(该图片是修改mysql默认密码的步骤,打红对勾的是要输入的命令,红色涂抹的是你设置的密码,注意密码要加单引号)

使用 create table 语句可完成对表的创建, create table 的常见形式:

create table 表名称(列声明);(注意要是创建表,要在选择在哪一个数据库,先使用use 数据库名;(不知道有哪些数据库时可以使用show databases;来看目前有哪些数据库,也可以自行创建:创建命令,create database 数据库名))

eg:

   create table student(
    id int unsigned not null auto_increment primary key,
    name char(8) not null,
    sex char(4) not null,
    age tinyint unsigned not null,
    tel char(13) null default "-"
    );



猜你喜欢

转载自blog.csdn.net/zhang_09_11/article/details/80571610