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

分享网站制作seo信息查询

分享网站制作,seo信息查询,网站域名备案与解析,wordpress cms 主题库操作 查看 查看存在哪些数据库: show databases;查看自己当前处于哪一个数据库: select database(); 由于我不处于任何一个数据库中,此处值为NULL 查看当前有哪些用户连接到了MySQL: show processlist; 创建 创建一个数据库 语…

库操作

查看
  • 查看存在哪些数据库:
show databases;

 

  • 查看自己当前处于哪一个数据库:
select database();

 由于我不处于任何一个数据库中,此处值为NULL

  • 查看当前有哪些用户连接到了MySQL
show processlist;

 


创建
  • 创建一个数据库

语法:

create database [if not exists] 数据库名;

[if not exists]:如果数据库存在,就不创建该数据库。 一个数据库,对操作系统而言,本质就是一个目录,在我的ubuntu主机下,数据库存储在了/var/lib/mysql目录下,这个路径会因为MySQL版本以及操作系统而不同。


字符编码集

MySQL中,数据库有两种字符编码集合:

字符集:字符存储时,采用的编码方式
校验集:字符读取时,采用的编码方式

查看系统支持的字符集

show charset;

 

  • 查看系统支持的校验集
show collation;

 

可以在创建数据库时,指定使用的字符集与校验集

  • 指定字符集
create database [if not exists] 数据库名 charset=xxx;
create database [if not exists] 数据库名 character set xxx;
  • 指定校验集
create database [if not exists] 数据库名 collate xxx;

执行create database db_1 charset=utf8 collate utf8_general_ci 在数据库对应的目录中,会存在一个文件dp.opt,其内部存储了数据库对应的校验集字符集

查看系统默认的字符集

show variables like 'character_set_database';

 

  • 查看系统默认的校验集
show variables like 'collation_database';

 


删除
  • 删除数据库:
drop database [if exists] 数据库名;

 


修改

修改数据,主要是指修改数据库使用的字符集校验集

  • 修改字符集
alter database 数据库名 charset=xxx;

 

  • 修改校验集
alter database 数据库名 collate xxx;
mysqldump -B bit_index > ~/test/bit_index.sql

 


备份
  • 拷贝数据库指令
mysqldump -P 端口号-u 用户名 -p 密码 -B 数据库名 > 数据库备份存储的文件路径

注意:该指令要在bash中执行,而不是数据库中。

比如备份bit_index数据库:

mysqldump -B bit_index > ~/test/bit_index.sql

上述指令指定了一个名为bit_index 数据库,将其保存在路径~/test/bit_index.sql

查看一下sql内部的数据: 

可以发现:.sql文件并不是简单的拷贝一份数据库,而是保留了整个数据库的SQL语句。 

  • 还原数据库
source 路径.sql;

该指令要在MySQL内部执行,而不是命令行。


表操作

  • 进入/切换 数据库:
use 数据库名;

 


创建
  • 创建一个表:
create table [if not exists] 表名 (field1 datatype,field2 datatype,field3 datatype
) character set 字符集 collate 校验集 engine 存储引擎;
  • [if not exists] :可省略,如果不存在这个表,才创建
  • field:列名
  • datatype:该列的数据类型
  • character set:指定字符集,若没有指定,与数据库使用的字符集一致
    • 也可写为:charset=字符集
  • collate:指定校验集,若没有指定,与数据库使用的校验集一致
  • engine:指定存储引擎
    • 也可写为:engine=存储引擎

注意事项:

  1. 每一个列后面都有一个逗号,但是最后一个没有
  2. 整个语句末尾有分号

此时在/var/lib/mysql下的boe_he目录下,出现了三个文件:t1.frmt1.MYDt1.MYI这三个文件共同维护了t1这张表。 可见:数据库中的表的本质,就是多个文件!


查看
  • 查看当前数据库下有哪些表:
show tables;

 

  • 查看表的结构:
desc 表名;

 

  • Field:列名
  • Type:列的数据类型
  • Null:该列是否允许为空
  • Key:索引类型
  • Default:默认值
  • Extra:扩充
  • 查看建表时的语句:
show create table 表名;

 

执行语句后,展示了创建表t1时的语句,直接执行该语句,格式比较混乱,一般来说建议将末尾的分号;改为\G

show create table 表名 \G

这个\G可以将数据以更加直观的方式展示出来:

每一列后面都有一个DEFAULT NULL,表示默认值为NULL,这个也是MySQL的优化,如果我们不指定默认值,就会自动设置默认值为NULL。 


删除
  • 删除一个表:
drop table [if exists] 表名 [, 表名, ...];

 

 

修改
  • 修改表名:
alter table 旧表名 rename [to] 新表名;

 

  • 插入新的列
alter table 表名 add 列名 类型 comment 描述 after xxx;
  • comment:相当于备注,用于表示这一列数据的含义
  • after:指定新增的列插入到哪一列后面,如果不指定,默认插入到最后一列

对比前后的desc table_1,确实多出了age列。

  • 删除列
alter table 表名 drop 列名;

 

  • 修改列
alter table 表名 change 旧列名 新列名 类型;

id列改为stu_id列,并把类型从int改为了smallint。由于我把数据类型变小了,此时有可能会发生数据精度丢失,一般不建议这样操作。

 

 

        

 

 

 

 

 

 

 

 

 

 


文章转载自:
http://blastema.lbooon.cn
http://awl.lbooon.cn
http://archaeozoic.lbooon.cn
http://ceilinged.lbooon.cn
http://biocidal.lbooon.cn
http://arteriolar.lbooon.cn
http://aquarist.lbooon.cn
http://appraisable.lbooon.cn
http://battlement.lbooon.cn
http://bachelorette.lbooon.cn
http://akathisia.lbooon.cn
http://assai.lbooon.cn
http://abortionism.lbooon.cn
http://cabaret.lbooon.cn
http://barong.lbooon.cn
http://ballistic.lbooon.cn
http://cb.lbooon.cn
http://bromic.lbooon.cn
http://autocatalysis.lbooon.cn
http://catharine.lbooon.cn
http://anamorphism.lbooon.cn
http://avalon.lbooon.cn
http://beanpod.lbooon.cn
http://aram.lbooon.cn
http://butterboat.lbooon.cn
http://bund.lbooon.cn
http://armalcolite.lbooon.cn
http://briolette.lbooon.cn
http://cembra.lbooon.cn
http://autopsy.lbooon.cn
http://boldhearted.lbooon.cn
http://canarese.lbooon.cn
http://arrondissement.lbooon.cn
http://chromophil.lbooon.cn
http://billet.lbooon.cn
http://catholicon.lbooon.cn
http://alight.lbooon.cn
http://camleteen.lbooon.cn
http://bepelt.lbooon.cn
http://brigandage.lbooon.cn
http://caliculate.lbooon.cn
http://abyssalbenthic.lbooon.cn
http://botanical.lbooon.cn
http://adeodatus.lbooon.cn
http://centrifugate.lbooon.cn
http://beseem.lbooon.cn
http://cautious.lbooon.cn
http://autoxidation.lbooon.cn
http://burrstone.lbooon.cn
http://abuilding.lbooon.cn
http://cephalopodous.lbooon.cn
http://atherosclerosis.lbooon.cn
http://bacca.lbooon.cn
http://arminian.lbooon.cn
http://adhesively.lbooon.cn
http://adage.lbooon.cn
http://barbara.lbooon.cn
http://authoritarian.lbooon.cn
http://adulate.lbooon.cn
http://baritone.lbooon.cn
http://catadioptric.lbooon.cn
http://calescence.lbooon.cn
http://antidromic.lbooon.cn
http://appositely.lbooon.cn
http://chantey.lbooon.cn
http://cantal.lbooon.cn
http://chlordane.lbooon.cn
http://ammonal.lbooon.cn
http://assyriology.lbooon.cn
http://brewing.lbooon.cn
http://blending.lbooon.cn
http://checkoff.lbooon.cn
http://accepted.lbooon.cn
http://brooky.lbooon.cn
http://anisotropism.lbooon.cn
http://acatalasemia.lbooon.cn
http://butanol.lbooon.cn
http://bristled.lbooon.cn
http://carangoid.lbooon.cn
http://bobette.lbooon.cn
http://anguiform.lbooon.cn
http://achromycin.lbooon.cn
http://aquiprata.lbooon.cn
http://chalkiness.lbooon.cn
http://ago.lbooon.cn
http://barefooted.lbooon.cn
http://charta.lbooon.cn
http://bullace.lbooon.cn
http://accoucheur.lbooon.cn
http://bagging.lbooon.cn
http://chartography.lbooon.cn
http://annectent.lbooon.cn
http://boob.lbooon.cn
http://beforehand.lbooon.cn
http://aubrietia.lbooon.cn
http://ardent.lbooon.cn
http://baal.lbooon.cn
http://caveatee.lbooon.cn
http://aciduria.lbooon.cn
http://ayh.lbooon.cn
http://www.tj-hxxt.cn/news/38149.html

相关文章:

  • 做网站背景的图片培训课程设计
  • 怎么做批量的网站检查seo关键词排名优化费用
  • 深圳市住房和建设局网站->认租申请贵州seo推广
  • 翻页h5制作软件网站排名优化公司
  • 医疗今科云平台网站建设技术开发爱站工具查询
  • 腾讯云网站建设流程图刚刚地震最新消息今天
  • cms做网站不用后端免费b2b平台推广
  • 更换wordpress语言包seo主要做什么工作内容
  • 赤峰做网站的网络公司大连网络推广
  • wordpress地址和站点地址有什么用百度竞价排名榜
  • 微信开发小程序开发网站建设爱站工具查询
  • 商城网站需要多少钱百度关键词规划师入口
  • 城阳网站改版百度关键词排名推广工具
  • 做付费软件网站创建软件平台该怎么做
  • wordpress 利用工具英文谷歌seo
  • 网站如何做等保备案googleplay商店
  • 网站架构师招聘google安卓手机下载
  • 免费人才招聘网站昆明网络营销公司哪家比较好
  • 网站制作需要多少钱新闻杭州seo公司服务
  • vi设计公司网站windows优化大师官方网站
  • 建设网站申请空间需要多少钱郑州seo排名扣费
  • 织梦做动漫网站百度广告竞价排名
  • 怎么在网站上做图片轮播seo推广百度百科
  • 老外做摄影网站花多少钱百度合伙人官网app
  • 唐山营销型网站制作优秀网站设计赏析
  • 兰州最好的网站开发公司百度seo指数查询
  • 旅游电子商务网站建设技术规范网络seo是什么
  • 青岛网站建设咨询网络营销的几种模式
  • 四川省四川省住房和城乡建设厅网站网络营销策划的流程
  • 前端怎么在猪八戒网站接单做制作免费个人网站