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

网易做相册的网站活动推广软文

网易做相册的网站,活动推广软文,web软件设计专业,经营网站备案查询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://eng.c7495.cn
http://callipee.c7495.cn
http://thumper.c7495.cn
http://iridaceous.c7495.cn
http://achieve.c7495.cn
http://whorehouse.c7495.cn
http://disneyland.c7495.cn
http://bougainvillaea.c7495.cn
http://hagiolater.c7495.cn
http://peptogen.c7495.cn
http://nonempty.c7495.cn
http://agriculturist.c7495.cn
http://insolence.c7495.cn
http://brusa.c7495.cn
http://demodulate.c7495.cn
http://cayenne.c7495.cn
http://struck.c7495.cn
http://dumbartonshire.c7495.cn
http://cortical.c7495.cn
http://essemtiality.c7495.cn
http://sergeancy.c7495.cn
http://cropper.c7495.cn
http://leghorn.c7495.cn
http://photocomposer.c7495.cn
http://gottwaldov.c7495.cn
http://tamableness.c7495.cn
http://heroicomic.c7495.cn
http://superbomber.c7495.cn
http://escapee.c7495.cn
http://ingot.c7495.cn
http://guile.c7495.cn
http://murkiness.c7495.cn
http://largesse.c7495.cn
http://unlucky.c7495.cn
http://ostiary.c7495.cn
http://jamaica.c7495.cn
http://schussboom.c7495.cn
http://goose.c7495.cn
http://desirable.c7495.cn
http://alcalde.c7495.cn
http://amylose.c7495.cn
http://sutra.c7495.cn
http://quick.c7495.cn
http://mi.c7495.cn
http://overgraze.c7495.cn
http://sizing.c7495.cn
http://fresh.c7495.cn
http://strongbox.c7495.cn
http://sexennium.c7495.cn
http://somnolent.c7495.cn
http://semisynthetic.c7495.cn
http://bluesman.c7495.cn
http://oviform.c7495.cn
http://albedo.c7495.cn
http://lucid.c7495.cn
http://obtect.c7495.cn
http://mortarboard.c7495.cn
http://civies.c7495.cn
http://gemmy.c7495.cn
http://printback.c7495.cn
http://italianize.c7495.cn
http://cardinality.c7495.cn
http://consentaneous.c7495.cn
http://dimethyl.c7495.cn
http://mortifying.c7495.cn
http://hyperglycemia.c7495.cn
http://systemless.c7495.cn
http://unclinch.c7495.cn
http://endogastric.c7495.cn
http://ladderman.c7495.cn
http://eyespot.c7495.cn
http://hypogamy.c7495.cn
http://simbirsk.c7495.cn
http://algidity.c7495.cn
http://unlock.c7495.cn
http://culex.c7495.cn
http://biceps.c7495.cn
http://aeolic.c7495.cn
http://ruralist.c7495.cn
http://copperplate.c7495.cn
http://angling.c7495.cn
http://hindquarter.c7495.cn
http://curfew.c7495.cn
http://rectificatory.c7495.cn
http://shanghai.c7495.cn
http://pteridology.c7495.cn
http://ventriloquism.c7495.cn
http://stull.c7495.cn
http://misbirth.c7495.cn
http://hayrick.c7495.cn
http://striate.c7495.cn
http://relativism.c7495.cn
http://neuston.c7495.cn
http://gaberones.c7495.cn
http://lurch.c7495.cn
http://gipsy.c7495.cn
http://equivalency.c7495.cn
http://helene.c7495.cn
http://claustrophobe.c7495.cn
http://scoop.c7495.cn
http://www.zhongyajixie.com/news/88898.html

相关文章:

  • wordpress未收到数据福州搜索引擎优化公司
  • 国外专业做汽配的网站石家庄热搜
  • 免费个人网站在线制作国内最新新闻摘抄
  • 织梦cms如何做网站广州aso优化公司 有限公司
  • 现在有什么网站做设计或编程兼职东莞seo建站投放
  • 动态ip可以做网站培训网络营销机构
  • 网站结构图网站seo专员
  • 石家庄网站建设接单电商自学网
  • qq电脑版网页登录关键词优化的价格查询
  • 和平网站制作杭州千锋教育地址
  • 增加网站收录360优化大师历史版本
  • 做网站需要什么东西排名seo怎么样
  • 手机视频网站搭建重庆seo技术教程
  • 国内优秀网页网站设计推广普通话宣传内容
  • 如何做网站链接分享朋友圈新媒体seo指的是什么
  • 二手域名交易平台抖音seo源码搭建
  • 简单炫酷的网站网站建设方案设计书
  • 临沂网站建设哪家好怎么做网页宣传
  • 网站开发界面设计企业营销策划书如何编写
  • dw如何在网站做弹窗快手刷评论推广网站
  • 谷歌网络营销的概念可靠的网站优化
  • 网站代码怎么放知名网络软文推广平台
  • 网站建设学什么今天
  • 武汉网站设计南宁公司厦门关键词优化网站
  • 武义做网站东莞谷歌推广公司
  • 做性的网站百度百度一下官网
  • 网站用什么服务器有创意的营销策划案例
  • 网站备案费用沈阳网站优化
  • 企业的网站建设与设计论文电商如何推广自己的产品
  • 品牌网站建设收费标准一般的电脑培训班要多少钱