Database concepts, MySQL database, install MySQL, production environment variable, change passwords, cracking passwords, configuration files, basic operations (libraries and tables) database

Database Concepts:

Database Concepts
1. random saved to a file in the data format is vastly different
2. Software development directory specification
defines the location data stored
ps: data are stored in the local
section 3. Save the data saved to a public place All user data related to the relevant public must be the place to find

MySQL database:

The MySQL database
is essentially a web-based application to communicate
any underlying network-based communications software are socket

server
- based socket communication
- sending and receiving messages
-SQL statement (a common standard)
client
- based socket communication
- transceiver message
-SQL statement

ps: MySQL not only supports MySQL client to operate also support other programming languages directly manipulate
python java c ++ php syntax is not the same

DBMS: Database Management System

Relational Database

And may have limited relevance between data and data
relational databases are usually table structure, which means you're in a relational database
first step is to determine the structure of table

fields have a specific type of
deposit the name with the string
stored digital password
saved birthday date with

MySQL, oracle, sqlite, db2, sql server

Non-relational databases

Usually in the form of stored data k, v keys
redis, mongodb (document database is very close to non-relational data relational), memcache

MySQL can actually see it as a software support remote file operations

>>> library folder
list >>> file
recording data in the file line by line >>> is called a section of the recording
header is the first row of the table
Field Name Field Type +

Installing MySQL

Do not try the latest version of the software in the IT industry
after the download is the MySQL server and client download down
decompression
view the file directory


Start mysqld

1. Switch to bin directory

2. Do mysqld
PS: do pre-configured MySQL when the terminal is recommended that you use an administrator run as
windows + r to start a normal user
mysql when the initial landing was not directly enter a password
mysql sql statement is based semicolon semicolon default does not knock you completely did not enter
the client will let you continue to enter
the client login

mysql -h 127.0.0.1 -P 3306 -uroot -p
可以简写
mysql -uroot -p
如果不输入用户名和密码 默认是访客模式登陆 所能用到的功能很少
客户端退出登陆
exit;
quit;
查看所有的数据库
show databases;

查看某个进程

tasklist |findstr 名称

杀死进程

taskkill /F /PID 进程号

制作环境变量

将启动文件所在的路径添加到系统的环境变量中
注意:配置完之后一段要重新启动mysql服务端及cmd终端

将mysqld制作成系统服务
制作系统服务 你的cmd终端一定要是管理员身份
mysqld --install

 

 

修改密码

没有密码的情况下
mysqladmin -uroot -p password 123

 


有密码的情况下
mysqladmin -uroot -p123 password 123456

当命令输入错误的时候 可以用\c取消前面的命令 cancel

破解密码

先将已经启动的服务端停掉

1.跳过用户名和密码的验证功能 启动服务端
mysqld --skip-grant-tables 启动服务端 跳过授权表

2.修改管理员用户对应的密码
update mysql.user set password=password(123) where user='root' and host='localhost';

3.关闭当前服务端 重新以校验用户名密码的方式启动
4.正常以用户名密码的方式 连接mysql服务

配置文件

\s查看 mysql服务端简单配置
通常情况下配置文件的后缀都是ini结尾
mysql自带的配置文件不要修改
但是你可以新建一个配置文件 my.ini

mysql服务端在启动就会自动加载你的my.ini配置文件内的配置

修改完配置文件之后需要先将服务端停止 重新启动 才能生效

修改了配置文件一定要重启服务端

修改编码格式的配置文件:

数据库的基本操作

库 类似于文件夹

create database db1;

show databases; 查所有
show create database db1; 查单个

alter database db1 charset='gbk'; 修改编码

drop database db1; 删库

在创建表的时候 需要先指定库
指定库: use 库名
查看当前虽在的库: select database()


create table userinfo(id int,name char);


show tables; 查看某个库下面的所有的表
show create table userinfo;
desc userinfo; <==> describe userinfo;

alter table userinfo modify name char(32);

drop table userinfo;


记录
先创建一个库或者指定一个已经存在的库
切换到该库下 创建表
然后再操作记录
create database db1;
create table userinfo(id int,name char(32),password int);


insert into userinfo values(1,'jason',123); 插入单条数据
insert into userinfo values(1,'jason',123),(2,'egon',123),(3,'tank',123); 插入多条数据

select * from userinfo; 查询所有的字段信息
select name from userinfo; 查询指定字段信息
select id,name from userinfo where id=1 or name=tank; 带有筛选条件的字段信息

update userinfo set name='kevin' where id=1; 修改数据的一个字段信息
update userinfo set name='jason',password=666 where id=1; 修改数据的多个字段

delete from userinfo where id =1; 指定删符合条件的数据
delete from userinfo; 将表中的数据全部删除

 

Guess you like

Origin www.cnblogs.com/yangjiaoshou/p/11366358.html