1、初识数据库

我们在编写任何程序之前,都需要事先写好基于网络操作一台主机上文件的程序(socket服务端与客户端程序),于是有人将此类程序写成一个
专门的处理软件,这就是mysql等数据库管理软件的由来,但mysql解决的不仅仅是数据共享的问题,还有查询效率,安全性等一系列问题,
总之,把程序员从数据管理中解脱出来,专注于自己的程序逻辑的编写。

数据(Data):描述事物的符号记录称为数据,描述事物的符号既可以是数字,也可以是文字、图片,图像、声音、语言等,数据由多种表现形式,它们都可以经过数字化后存入计算机;在计算机中描述一个事物,就需要抽取这一事物的典型特征,组成一条记录,就相当于文件里的一行内容。

数据库(Databases,简称DB):数据库库即存放数据的仓库,只不过这个仓库是在计算机存储设备上,而且数据是按一定的格式存放的;数据库是长期存放在计算机内、有组织、可共享的数据即可。数据库中的数据按一定的数据模型组织、描述和储存,具有较小的冗余度、较高的数据独立性和易扩展性,并可为各种 用户共享。

数据库管理系统(DataBase Management System 简称DBMS)在了解了Data与DB的概念后,如何科学地组织和存储数据,如何高效获取和维护数据成了关键

这就用到了一个系统软件---数据库管理系统如MySQL、Oracle、SQLite、Access、MS SQL Server

常见的数据库模型分为关系型数据库(MySQL、Oracle、SQL Server....)和非关系型数据库(文档存储数据库MongoDB;键值存储数据库Redis、Memcached、列存储数据库HBase、图形数据库Neo4J)

 

mysql主要用于大型门户,例如搜狗、新浪等,它主要的优势就是开放源代码,因为开放源代码这个数据库是免费的,他现在是甲骨文公司的产品。
oracle主要用于银行、铁路、飞机场等。该数据库功能强大,软件费用高。也是甲骨文公司的产品。
sql server是微软公司的产品,主要应用于大中型企业,如联想、方正等。

数据库服务器-:运行数据库管理软件

数据库管理软件:管理-数据库

数据库:即文件夹,用来组织文件/表

表:即文件,用来存放多行内容/多条记录

1.1mysql的安装

mysql就是一个基于socket编写的C/S架构的软件
客户端软件
  mysql自带:如mysql命令,mysqldump命令等
  python模块:如pymysql

数据库管理软件分类--->>> 分两大类:   关系型:如sqllite,db2,oracle,access,sql server,MySQL,注意:sql语句通用   非关系型:mongodb,redis,memcache 可以简单的理解为: 关系型数据库需要有表结构 非关系型数据库是key
-value存储的,没有表结构

mysql windows7的安装:https://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345bf0.html?qq-pf-to=pcqq.c2c

 

 

关于如何清除mysql,很不好清除,一系列的注册表什么的:参考 https://blog.csdn.net/renwudao24/article/details/51860752

第八章| 1. MySQL数据库|库操作|表操作

 

存储数据的仓库

mysql就是套接字服务端、客户端而已;

 win+R 输入servers.msc 找到服务里边去启动mysql

 

select user(); #查看当前登录的账号

mysql> select user();
+----------------+
| user()         |
+----------------+
| ODBC@localhost |  #代表本地账号
+----------------+
1 row in set (0.10 sec)

 

C:\Users\Administrator>mysql -uroot -p #uroot就是管理员账号
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
....

mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

 

C:\Users\Administrator>mysqladmin -uroot -p password '123' #修改默认密码 
Enter password:
Warning: Using a password on the command line interface can be insecure.
Warning: single quotes were not trimmed from the password by your command
line client, as you might have expected.

 

C:\Windows\System32>tasklist | findstr mysql
mysqld.exe                    2032 Services                   0      5,324 K

C:\Windows\System32>taskkill /F /PID 2032
成功: 已终止 PID 为 2032 的进程。

C:\Windows\System32>net start MySQL
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。

 

1.2修改mysql字符编码

 统一字符编码

关于win7修改默认字符编码:https://blog.csdn.net/u013474104/article/details/52486880

建个my.ini配置文件

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]
character-set-server=utf8 
collation-server=utf8_general_ci
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir = C:\mysql-5.6.39-winx64  #这两个需要自行修改配置下path
datadir = C:\mysql-5.6.39-winx64\data 
# port = .....
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysql]
default-character-set = utf8

[mysql.server]
default-character-set = utf8


[mysqld_safe]
default-character-set = utf8


[client]
default-character-set = utf8

 
View Code

相关文章:

  • 2022-12-23
  • 2021-12-05
  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-02-03
猜你喜欢
  • 2021-11-22
  • 2021-11-18
  • 2021-09-23
  • 2021-10-10
  • 2021-12-03
  • 2022-12-23
  • 2021-12-06
相关资源
相似解决方案