添加用户 以root用户登录数据库,运行以下命令: 上面的命令创建了用户zhangsan,密码是zhangsan。在mysql.user表里可以查看到新增用户的信息: 授权 命令格式:grant privilegesCode on dbName.tableName to username@host ...
分类:
数据库 时间:
2018-01-23 13:06:18
阅读次数:
221
create table tableName( columnName nvarchar(20) not null default'默认值', columnName1 nvarchar(20) null, columnName2 int identity(1,1)--创建自增长字段 CONSTRAIN ...
分类:
数据库 时间:
2018-01-21 19:11:26
阅读次数:
211
一、数据定义 1、创建新数据库:CREATE DATABASE database_name2、创建新表:CREATE TABLE table_name (column_name datatype,column_name datatype,...)3、修改数据表: 添加列:ALTER TABLE ta ...
分类:
数据库 时间:
2018-01-16 18:28:55
阅读次数:
191
1.selectcount()frommysql.user;//查找mysql库的user表的行数mysql>selectcount()frommysql.user;//count()在myisam会很快、innoDB引擎就会很慢(不会去统计行数,很耗时),所有的操作尽量减少+----------+|count(*)|+----------+|8|+----------+2.selectfr
分类:
数据库 时间:
2018-01-16 11:15:55
阅读次数:
182
mysql用户管理1.创建一个普通用户并授权[root@gary-tao~]#mysql-uroot-p‘szyino-123‘Warning:Usingapasswordonthecommandlineinterfacecanbeinsecure.WelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis24Serv
分类:
数据库 时间:
2018-01-15 20:30:32
阅读次数:
195
13.4mysql用户管理创建用户并授权[root@taoyuan~]#mysql-uroot-p‘taoyuan‘//登录mysql>grantallon*.*to‘user1‘@‘172.0.0.1‘identifiedby‘123456‘;#创建user用户并授予其所有权限“*.*”(通配符)#第一个*表示db_name;第二个*表示tb_name#同时指定其来源IP127.0.0.1
分类:
数据库 时间:
2018-01-15 18:49:50
阅读次数:
177
mysql用户管理创建一个网站需要连接Mysql,默认是root用户,但是我们不能总是连接root,万一操作错误就会出问题对于某个数据库,给user1设定权限grantallon*.*to‘user1‘identifiedby‘passwd‘;mysql>grantallon*.*to‘user‘identifiedby‘123‘;QueryOK,0rowsaffected(0.00sec)
分类:
数据库 时间:
2018-01-15 11:07:33
阅读次数:
242
基础篇 //查询时间,友好提示$sql = "select date_format(create_time, '%Y-%m-%d') as day from table_name";//int 时间戳类型$sql = "select from_unixtime(create_time, '%Y-%m ...
分类:
数据库 时间:
2018-01-12 22:36:20
阅读次数:
216
从磁盘中取出数据 mysql用户管理 mysql客户端命令 SQL入门-库定义 SQL入门-表定义 SQL入门-表定义 SQL入门-DML-DQL-字符集 SQL入门-DML数据操作语言--insert into SQL入门-DML数据操作语言--delete SQL入门-DQL数据查询语言--se ...
分类:
数据库 时间:
2018-01-07 17:31:26
阅读次数:
230