当前位置: 首页 > news >正文

网易做相册的网站吴江seo网站优化软件

网易做相册的网站,吴江seo网站优化软件,雅思培训机构哪家好机构排名,找供应商去哪个网站1.MySQL连接 连接命令一般是这样写的 mysql -h$ip -P$port -u$user -p比如:mysql -h127.0.0.1 -P3306 -uroot -p -h 指定连接的主机地址;-P 指定连接端口号;-u 指定用户名 -p指定用户名密码 2.SQL分类 DDL(Data Definition Language) 数据定义语言&…

1.MySQL连接

连接命令一般是这样写的

mysql -h$ip -P$port -u$user -p比如:mysql -h127.0.0.1 -P3306 -uroot -p

-h 指定连接的主机地址;-P 指定连接端口号;-u 指定用户名 -p指定用户名密码

2.SQL分类

  1. DDL(Data Definition Language) 数据定义语言:操作数据库和表,定义数据库对象:数据库,表,列等。关键字:create, drop,alter 等
  2. DML(Data Manipulation Language) 数据操作语言:增删改表中数据,对数据库中表的数据进行增删改。关键字:insert, delete, update 等
  3. DQL(Data Query Language) 数据查询语言:查询表中数据,用来查询数据库中表的记录(数据)。关键字:select, where 等
  4. DCL(Data Control Language) 数据控制语言:管理用户,授权,定义数据库访问权限和安全级别及创建用户。关键字:GRANT, REVOKE 等

 3.DDL(Data Definition Language) 数据定义语言

这是操作数据库和表的定义的。

对数据库进行操作

创建

--标准语法
create database 数据库名;--创建数据库,判断不存在,再创建(数据库已存在的话,就不能再创建同名的数据库)
create databases if not exists 数据库名称;--创建数据库,并指定字符集
create database 数据库名 character set 字符集名称;

查询

--查看所有数据库
show databases;--查看当前使用的是哪个数据库
select database();--查询某个数据库的字符集/创建语句
show create database 数据库名称;例子: 
--加'\G'是为了数据显示的好看,不加也行的。
mysql> show create database test\G;
*************************** 1. row ***************************Database: test
Create Database: CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */
1 row in set (0.00 sec)

修改

--修改数据库的字符集
alter database 数据库名称 character set 字符集名称;--没有命令修改数据库名字的

删除

--删除数据库
drop database 数据库名称;--判断数据库是否存在,存在再删除 
drop database if exists 数据库名称;例子:删除不存在的数据库
mysql> drop database aa;
ERROR 1008 (HY000): Can't drop database 'aa'; database doesn't exist

使用

--使用数据库
use 数据库名称

对表进行操作

创建

--创建表
create table 表名(列名1 数据类型1,列名2 数据类型2... 列名n 数据类型n);--复制表
create table 表名 like 被复制的表名;例子:
create table mytest(id int not null primary key,name varchar(10),age int not null);

查询

--查看该数据库的所有表
show tables;--查看表的所有字段
desc 表名;--查看创建表的语句和字符集
show create table 表名;--查看表的具体信息
show table status from 库名 like '表名';例子:
mysql> show create table mytest\G;
*************************** 1. row ***************************Table: mytest
Create Table: CREATE TABLE `mytest` (`id` int NOT NULL,`name` varchar(10) DEFAULT NULL,`age` int NOT NULL,PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.00 sec)mysql> show table status from test like 'mytest'\G;
*************************** 1. row ***************************Name: mytestEngine: InnoDBVersion: 10Row_format: DynamicRows: 0Avg_row_length: 0Data_length: 16384
Max_data_length: 0Index_length: 0Data_free: 0Auto_increment: NULLCreate_time: 2024-01-26 19:06:33Update_time: NULLCheck_time: NULLCollation: utf8mb4_0900_ai_ciChecksum: NULLCreate_options: Comment: 
1 row in set (0.00 sec)

修改:(使用atler)

--修改表名
alter table 表名 rename to 新的表名;--添加字段(列)
alter table 表名 add 列名 数据类型 约束;--修改列的数据类型
alter table 表名 change 列名 新列名 新数据类型;
比如:alter table myname change name nickname varchar(100);--删除字段(列)
alter table 表名 drop 字段名;--修改表的字符集 
alter table 表名 character set 字符集名称;

删除

--删除表
drop table 表名;--判断表是否存在,存在就删除 (因为删除不存在的表,会报错)
drop table if exists 表名 ;

4.DML(Data Manipulation Language) 数据操作语言

这是主要针对表中的数据的。

添加数据

--标准语法
insert into 表名(列名1,列名2,...) values(值1,值2,...);--默认给全部列添加数据
insert into 表名 values(值1,值2,值3,...);--批量添加
insert into 表名 values(值1,值2,值3,...),(值1,值2,值3,...),(值1,值2,值3,...);注意:插入数据时,字段名顺序 与 值顺序 要一一对应例子:
mysql> insert into mytest values(1,'wo',11);
Query OK, 1 row affected (0.01 sec)mysql> insert into mytest(id,age) values(3,41);
Query OK, 1 row affected (0.01 sec)mysql> insert into mytest(id,age) values(4,41),(5,23),(6,29);
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0mysql> insert into mytest values(7,'中高',55),(9,'上',50); 
Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0mysql> select * from mytest;
+----+--------+-----+
| id | name   | age |
+----+--------+-----+
|  1 | wo     |  11 |
|  3 | NULL   |  41 |
|  4 | NULL   |  41 |
|  5 | NULL   |  23 |
|  6 | NULL   |  29 |
|  7 | 中高   |  55 |
|  9 | 上     |  50 |
+----+--------+-----+
7 rows in set (0.01 sec)

 删除数据

--删除表数据(可以带有条件)
delete from 表名 [where 条件]例子:
mysql> delete from mytest where id=1;
Query OK, 1 row affected (0.01 sec)mysql> delete from mytest;
Query OK, 6 rows affected (0.01 sec)

 修改数据

--修改数据
update 表名 set 字段1 = 值1, 字段2 = 值2,... [where 条件];--注意: 修改语句的条件可以有,也可以没有,如果不加任何条件,则会将表中所有记录全部修改例子:
mysql> update mytest set age=15 where age=41;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0mysql> update mytest set age=15 where id=5;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0mysql> update mytest set age=15;
Query OK, 1 row affected (0.00 sec)
Rows matched: 3  Changed: 1  Warnings: 0

5.DQL(Data Query Language) 数据查询语言

--查找整个表的所有数据
select * from 表名--查找表的某些字段,并带有条件
select  列名1,列名2... from 表名 where 条件

 

6. DCL(Data Control Language) 数据控制语言

管理用户,权限

--查看所有的用户
select * from mysql.user; # mysql是数据库,user是表名--创建用户
create user '用户名'@'主机名' identified by '密码';--修改用户密码
alter user '用户名'@'主机名' identified with mysql_native_password by '新密码';--有些MySQL客户端并未完全支持MySQL 8.0的caching_sha2_password加密方式,而MySQL 8.0中默认是caching_sha2_password加密方式。所以要想那些登录失败的客户端可以通过登录,升级客户端或者把密码修改成是mysql_native_password加密方式。--删除用户
drop user '用户名'@'主机名';--权限相关的
--查询权限 
show grants for '用户名'@'主机名' ;--授予权限 
grant 权限列表 on 数据库名.表名 to '用户名'@'主机名';--撤销权限 
revoke 权限列表 on 数据库名.表名 from '用户名'@'主机名';--查看用户的加密方式
mysql> select host,user,plugin from mysql.user;                      
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | root             | caching_sha2_password |
| localhost | itcast           | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | caching_sha2_password |
+-----------+------------------+-----------------------+

注意:

  • 在MySQL中需要通过 用户名@主机名 的方式,来唯一标识一个用户
  • 主机名可以使用 % 通配,例如:'root'@'%'这样就可以在任一台服务器进行登录,而'root'@'localhost'就只能在本地登录。

文章转载自:
http://thug.sfwd.cn
http://motherlike.sfwd.cn
http://isothermal.sfwd.cn
http://xxv.sfwd.cn
http://josd.sfwd.cn
http://baa.sfwd.cn
http://subsegment.sfwd.cn
http://cleruchial.sfwd.cn
http://expostulate.sfwd.cn
http://klamath.sfwd.cn
http://modiste.sfwd.cn
http://endive.sfwd.cn
http://dissonance.sfwd.cn
http://porcupine.sfwd.cn
http://goatherd.sfwd.cn
http://unmeditated.sfwd.cn
http://repleader.sfwd.cn
http://oosperm.sfwd.cn
http://fossilist.sfwd.cn
http://bushie.sfwd.cn
http://abaptiston.sfwd.cn
http://candle.sfwd.cn
http://incorruptible.sfwd.cn
http://slipshod.sfwd.cn
http://vein.sfwd.cn
http://downdraght.sfwd.cn
http://mere.sfwd.cn
http://wheezily.sfwd.cn
http://baldpate.sfwd.cn
http://qbp.sfwd.cn
http://actualism.sfwd.cn
http://aptly.sfwd.cn
http://chuckawalla.sfwd.cn
http://lipin.sfwd.cn
http://pugilism.sfwd.cn
http://bitumen.sfwd.cn
http://dilettantist.sfwd.cn
http://afeard.sfwd.cn
http://catenate.sfwd.cn
http://fingernail.sfwd.cn
http://phosphatidyl.sfwd.cn
http://pyrethrum.sfwd.cn
http://parturient.sfwd.cn
http://programing.sfwd.cn
http://soporiferous.sfwd.cn
http://caulis.sfwd.cn
http://chartography.sfwd.cn
http://overcanopy.sfwd.cn
http://catholicate.sfwd.cn
http://avon.sfwd.cn
http://viticulture.sfwd.cn
http://counterdrive.sfwd.cn
http://amylum.sfwd.cn
http://orchidectomy.sfwd.cn
http://carburetor.sfwd.cn
http://kilter.sfwd.cn
http://jokesmith.sfwd.cn
http://filefish.sfwd.cn
http://nucleophile.sfwd.cn
http://umbrageous.sfwd.cn
http://cabbagehead.sfwd.cn
http://deccan.sfwd.cn
http://similarity.sfwd.cn
http://esl.sfwd.cn
http://debauchery.sfwd.cn
http://determinate.sfwd.cn
http://wort.sfwd.cn
http://signally.sfwd.cn
http://muskeg.sfwd.cn
http://crotch.sfwd.cn
http://instantly.sfwd.cn
http://intrastate.sfwd.cn
http://leninism.sfwd.cn
http://aubergiste.sfwd.cn
http://shogun.sfwd.cn
http://baccivorous.sfwd.cn
http://pachisi.sfwd.cn
http://laniary.sfwd.cn
http://medical.sfwd.cn
http://counterconditioning.sfwd.cn
http://listerine.sfwd.cn
http://jura.sfwd.cn
http://gharry.sfwd.cn
http://amicron.sfwd.cn
http://cardiocirculatory.sfwd.cn
http://pelasgic.sfwd.cn
http://norethindrone.sfwd.cn
http://overexcite.sfwd.cn
http://intravehicular.sfwd.cn
http://cubbyhouse.sfwd.cn
http://labilise.sfwd.cn
http://expellent.sfwd.cn
http://dredge.sfwd.cn
http://unsuited.sfwd.cn
http://cue.sfwd.cn
http://fulgurate.sfwd.cn
http://leucoma.sfwd.cn
http://eyelid.sfwd.cn
http://louvred.sfwd.cn
http://superelevate.sfwd.cn
http://www.hrbkazy.com/news/61329.html

相关文章:

  • app调用网站交换友情链接平台
  • 浙江网页设计昆明seo培训
  • 试客网站 源码网站备案查询官网
  • vi设计 站酷推广普通话手抄报简单漂亮
  • 阿里云网站建设方案书填写百度推广手机客户端
  • 寻找网站建设公司音乐接单推广app平台
  • 长沙简单的网站建设公司标题关键词优化报价
  • 做网站没有做退钱洛阳网站建设
  • 如何利用js来做网站表单南宁网站建设公司
  • 公司网站做百度推广需要交费吗seo网站推广费用
  • 怎么注册公司邮箱账号seo工作职责
  • 集团门户网站建设企业全搜网
  • 做设计有必要买素材网站会员武汉楼市最新消息
  • 做地方网站要办什么证做企业网站哪个平台好
  • 如何去建立和设计一个公司网站网店推广网站
  • 网站建设方案流程网络营销外包收费
  • 深圳优秀网站建设价格南宁关键词优化服务
  • 移动端网站开发环境武汉seo管理
  • 网站做推荐链接端口seo中国
  • 变态传奇手游发布网站外贸业务推广
  • 河南网站建设企业网站运营是做什么的
  • wordpress 添加自定义按钮上海seo优化
  • 网站建设实训致谢语百度爱采购怎样入驻
  • 嘉兴网站搜索排名推广产品怎么发朋友圈
  • 万网网站建设流程广告媒体资源平台
  • 做网站多少钱 优帮云鞋子软文推广300字
  • 给wordpress插件添加po文件怎么快速优化网站
  • 鲜花网网站建设的目的全网推广费用
  • 怎样健网站推广方案的内容有哪些
  • 密云网站制作案例软文广告经典案例300字