批改状态:合格
老师批语:
//登陆mysql -u root -p //root为数据名//查询数据库show databases;(必须分号结束)//查询表show tables;
//创建用户create user 'xxw'@localhost indentified by '123456'//给用户授权grant create,alter,drop,select on xxw.* to xxw@localhost;//查看权限show grants for xxw@localhost;//撤销权限revoke create on xxw.* from xxw@localhost;//删除用户drop user xxw@localhost;//修改密码alter user xxw@localhost identified by '123456';
//增INSERT `user` SET `name`='admin',`pwd`=`5445saswuq`;//删DELETE FROM `user` WHERE `id`=5//查SELECT `id`,`name` FROM `user`//改UPDATE `user` SET `name`='zhu' WHERE `id`=5;
timestamp存储需要4个字节,它的取值范围为“1970-01-01 00:00:01” UTC ~ “2038-01-19 03:14:07” (和时区有关).timestamp取值显示的时候时间是根据时区来显示的.
datetime存储需要8个字节,取值范围为“1000-01-01 00:00:00” ~ “9999-12-31 23:59:59”(和时区无关)
//用pdo基类链接数据库$dsn = 'mysql:host=localhost;dbname=xxw';try {$db = new PDO($dsn, 'xxw', '123456');} catch (PDOException $e) {die('连接失败' . $e->getMessage());}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号