什么集成mysql_mysql集成部署

经常听说mysql数据库是集成在系统中,也一直不太明白集成的概念。今天才明白集成的概念就是将mysql所有的文件放到一个文件夹下放到系统中,也就是将mysql采用目录迁移部署的方式进行安装。在上一篇研究了mysql的数据存储结构之后,也研究了mysql作为目录部署以及安装为mysql服务的方法。

1.mysql目录安装

mysql目录安装也就是将mysql必须的一些文件放到一起,然后通过配置文件的配置即可实现。

mysql主要的目录也就是data目录以及bin(存mysql的可执行文件)、lib(存放mysql的dll库)、share(存放mysql的语言支持库)、uploads(一般作为mysql的导出目录)、my.ini(mysql的端口以及其他全局配置文件)。

例如我的目录安装的一个目录:

418b7cdd20d7ba771f54199b641d9976.png

bin、lib、share、Uploads是直接从mysql5.7的安装目录下拷贝过来的,Data目录也是拷贝的,上篇文章已经讲解过Data目录下存放具体的Mysql的数据库以及表结构与表数据,查看Data的目录如下(是在原来的数据库迁移古来,所以如果集成部署成功数据库应该与原来一样):

00ef5d7a5570f11ae64f5e87207d86a9.png

my.ini文件:(注意标红位置的修改)

[client]

no-beep

port=3307[mysql]default-character-set=utf8

# server_type=3[mysqld]

# The TCP/IP Port the MySQL Server will listen on

port=3307# Path to installation directory. All paths are usually resolved relative tothis.

# basedir="C:/Program Files/MySQL/MySQL Server 5.7/"# Path to the database root

datadir=G:\mysql572\Data

# Thedefault character set that will be used when a new schema or table is# created and no characterset isdefined

character-set-server=utf8

# Thedefault storage engine that will be used when create newtables whendefault-storage-engine=INNODB

# Set the SQL mode to strict

sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"# Enable Windows Authentication

# plugin-load=authentication_windows.dll

# General and Slow logging.

log-output=FILE

general-log=0general_log_file="MicroWin10-1535.log"slow-query-log=1slow_query_log_file="MicroWin10-1535-slow.log"long_query_time=10# Binary Logging.

log-error="MicroWin10-1535.err"# Server Id.

server-id=1# Secure File Priv.

secure-file-priv="G:\mysql572\Uploads"max_connections=151query_cache_size=0table_open_cache=2000tmp_table_size=34M

thread_cache_size=10myisam_max_sort_file_size=100G

myisam_sort_buffer_size=60M

key_buffer_size=8M

read_buffer_size=64K

read_rnd_buffer_size=256K

#*** INNODB Specific options ***# innodb_data_home_dir=0.0# Usethis option ifyou have a MySQL server with InnoDB support enabled

# but youdonot plan to use it. This will save memory and disk space

# and speed up some things.

# skip-innodb

# Ifset to 1, InnoDB will flush (fsync) the transaction logs to the

# disk at each commit, which offers full ACID behavior. If you are

# willing to compromisethissafety, and you are running small

# transactions, you mayset this to 0 or 2 to reduce disk I/O to the

# logs. Value0 means that the log isonly written to the log file and

# the log file flushed to disk approximately once per second. Value2# means the logiswritten to the log file at each commit, but the log

# fileisonly flushed to disk approximately once per second.

innodb_flush_log_at_trx_commit=1# The size of the buffer InnoDB usesfor buffering log data. As soon as# itis full, InnoDB will have to flush it to disk. As it isflushed

# once per second anyway, it does not make sense to have it very large

# (even withlongtransactions).

innodb_log_buffer_size=1M

# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and

# row data. The bigger youset this the less disk I/O isneeded to

# access datain tables. On a dedicated database server you may set this# parameter up to80% of the machine physical memory size. Do not setit

# too large, though, because competition of the physical memory may

# cause paginginthe operating system. Note that on 32bit systems you

# might be limited to2-3.5G of user level memory per process, so donot

#setit too high.

innodb_buffer_pool_size=8M

# Size of each log filein a log group. You should setthe combined size

# of log files to about25%-100%of your buffer pool size to avoid

# unneeded buffer pool flush activity on log file overwrite. However,

# note that a larger logfile size will increase the time neededforthe

# recovery process.

innodb_log_file_size=48M

# Number of threads allowed inside the InnoDB kernel. The optimal value

# depends highly on the application, hardwareas well asthe OS

# scheduler properties. A too high value may lead to thread thrashing.

innodb_thread_concurrency=9# The increment size (in MB) for extending the size of an auto-extend InnoDB system tablespace file when it becomes full.

innodb_autoextend_increment=64# The number of regions that the InnoDB buffer poolisdivided into.

# For systems with buffer poolsin the multi-gigabyte range, dividing the buffer pool into separate instances can improve concurrency,

# by reducing contentionasdifferent threads read and write to cached pages.

innodb_buffer_pool_instances=8# Determines the number of threads that can enter InnoDB concurrently.

innodb_concurrency_tickets=5000# Specifies howlong inmilliseconds (ms) a block inserted into the old sublist must stay there after its first access before

# it can be moved to thenewsublist.

innodb_old_blocks_time=1000# It specifies the maximum number of .ibd files that MySQL can keep open at one time. The minimum valueis 10.

innodb_open_files=300# Whenthis variable isenabled, InnoDB updates statistics during metadata statements.

innodb_stats_on_metadata=0# When innodb_file_per_tableis enabled (the default in 5.6.6 and higher), InnoDB stores the data and indexes foreach newly created table

#in a separate .ibd file, rather than inthe system tablespace.

innodb_file_per_table=1innodb_checksum_algorithm=0back_log=80flush_time=0join_buffer_size=256K

max_allowed_packet=4M

max_connect_errors=100open_files_limit=4161query_cache_type=0sort_buffer_size=256K

table_definition_cache=1400binlog_row_event_max_size=8K

sync_master_info=10000sync_relay_log=10000sync_relay_log_info=10000

2.启动上面的mysql并且进行连接

G:\mysql572\bin>mysqld --defaults-file=G:\mysql572\my.ini

新开cmd窗口查看进程信息:

C:\Users\liqiang>tasklist |findstr mysql

mysqld.exe1912 Services 0 228,348K

mysqld.exe325752 Console 9 208,488K

mysql.exe325984 Console 9 5,328K

C:\Users\liqiang>netstat -ano | findstr 3307TCP0.0.0.0:3307 0.0.0.0:0 LISTENING 325752TCP [::]:3307 [::]:0 LISTENING 325752TCP [::1]:3307 [::1]:61234 ESTABLISHED 325752TCP [::1]:61234 [::1]:3307 ESTABLISHED 325984

连接上面启动的3307端口的mysql:

C:\Users\liqiang>mysql -uroot -p -P3307

Enter password:******Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 2Server version:5.7.10-log MySQL Community Server (GPL)

Copyright (c)2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clearthe current input statement.

mysql> show variables like ‘log_error‘;+---------------+-----------------------+

| Variable_name | Value |

+---------------+-----------------------+

| log_error | .\MicroWin10-1535.err |

+---------------+-----------------------+

1 row in set, 1 warning (0.01sec)

mysql> show variables like ‘datadir‘;+---------------+-------------------+

| Variable_name | Value |

+---------------+-------------------+

| datadir | G:\mysql572\Data\ |

+---------------+-------------------+

1 row in set, 1 warning (0.00 sec)

3.将上面目录安装的mysql安装为windows服务

需以管理员身份执行cmd

C:\Windows\system32>G:\mysql572\bin\mysqld --install mysql572 --defaults-file="G:\mysql572\my.ini"Service successfully installed.

查看上面安装的服务:

C:\Windows\system32>sc qc mysql572

[SC] QueryServiceConfig 成功

SERVICE_NAME: mysql572

TYPE :10WIN32_OWN_PROCESS

START_TYPE :2AUTO_START

ERROR_CONTROL :1NORMAL

BINARY_PATH_NAME : G:\mysql572\bin\mysqld--defaults-file=G:\mysql572my.ini mysql572

LOAD_ORDER_GROUP :

TAG :0DISPLAY_NAME : mysql572

DEPENDENCIES :

SERVICE_START_NAME : LocalSystem

安装成功之后即可像正常的服务一样使用,启动可以用sc start mysql

删除服务也与平时删除服务一样:

sc delete mysql572

或者采用mysqld方式移除系统服务

mysqld--remove MySQL57

至此mysql集成安装完成,在实际的项目中我们可以采用这种方式将mysql嵌入到系统中进行部署安装。下面附一份实际项目中的my.ini的配置:

原文:https://www.cnblogs.com/qlqwjy/p/9484582.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/464728.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

一文让你了解RT-Thread

前言要学习一项新知识或新的技能,首先要对其有个初步了解,然后再逐步学习如何运用它。本文作为快速入门 RT-Thread 系列文章的第一篇,首先介绍一下,我当时是如何学习 RT-Thread 的,以及参与官方组织的活动的情况&#…

Network Service 权限问题

今天在做asp.net的定时删除服务器上的文件时,出了错误,在本地测试都好着呢,可是一部署到服务器上,删除文件的那个方法就不执行,后来在网站查了是Network Service权限设置问题,Network Service 是 Windows S…

创建python虚拟环境

一 windows下如何构建虚拟环境如果系统中只有python2或只有python3,可以直接打开命令行,输入pip install virtualenv 来下载创建虚拟环境的包(如果提示pip不是内部命令,把python文件下的Scripts的文件路径加入计算机环境变量即可可) 1. 选择一…

二分法查找(C/C++)

当数据量很大适宜采用该方法。采用二分法查找时,数据需是排好序的,默认是按 升序 排好的。时间复杂度:O(logn) 集合中的set和map中使用二分法进行查找的。 int BiSearch(char *str, int n, char find) //返回值是:下标 { int low 0, mi…

电源开关上的 | 和 O 究竟代表了什么?

大家好,我是写代码的篮球球痴,转发张老师的一篇文章。几乎所有的电器、灯具和插座上只要带有电源开关必然会出现“|”和“O”两个符号。如果只看符号判断,“|”和“O”到底代表什么含义呢?能分清:哪个是电路联通,哪个是…

python卸载模块的方法汇总_Python卸载模块的方法汇总

easy_install 卸载通过easy_install 安装的模块可以直接通过 easy_install -m PackageName 卸载,然后删除\python27\Lib\site-packages目录下的egg。setup.py 卸载通过发行包附带的setup.py安装的模块,首选setup.py提供的uninstall选项。如果作者没有提供…

最老程序员创业札记:全文检索、数据挖掘、推荐引擎应用8

辞职创业吴言在经过了几天的反复思考,终于下定决心辞职创业了。做出这个决定真的需要很大的勇气,因为自己的年纪做为程序员来说,已经属于很高龄了,如果创业失败几乎没有退路,再找工作将很难,合适的工作几乎…

重庆大二学生花了6年写出了操作系统

一直以来,国内操作系统都是弱势的地方,可能是国情原因吧,事实上国内也有不少人想改变这种格局,一直以来,笔者的朋友也在一直为这个方向努力,xbook内核,作者花了6年时间,从初中开始就…

逆转一个链表

在一个list中,我们先让头结点的next域指向结点2,再让结点1的next域指向结点3,最后将结点2的next域指向结点1,就完成了第一次交换,顺序就变成了Header-结点2-结点1-结点3-结点4-NULLtypedef struct _list_t{struct _lis…

Django form choices, placeholder

itemCharField(max_length20,min_length1,requiredTrue,widgetwidgets.TextInput({placeholder:testing,}),) typeCharField(min_length1,max_length4,requiredTrue,widgetSelect(choices((0,P),(1,M))),) 转载于:https://www.cnblogs.com/pythonClub/p/9782147.html

《大话存储__网络存储系原理精解与最佳实践》电子书下载

大话存储__网络存储系原理精解与最佳实践,经典图书 网络存储,是近二十年来的新兴行业。从纸带到硬盘再到大型磁盘阵列,存储系统经历了从简单到复杂,从单块硬盘到存储区域网络(SAN)。网络存储行业目前已经是…

辉哥给rockchip修复了一个内存溢出问题

还是周末我也不想说周末,但是不是周末的话,可能也没有特别清净的时间来处理困难的问题。这周末我是要加班的,加班的前一个晚上,我领导找我们吃了一个便饭,聊了很多东西,这篇文章我就不说了,会在…

习题1-3

#include<stdio.h> int main() {int n,sum0;scanf("%d", &n);for (int i 1; i < n1; i){sum sum i;}printf("%d\n",sum);return 0; } 连续和转载于:https://www.cnblogs.com/zhuzehua/p/9783091.html

将一个数组里面的奇数全部排在前面,偶数排在后面

将一个数组里面的奇数全部排在前面&#xff0c;偶数排在后面 方法1&#xff1a;使用数组。 void paixu(int dest[], int n, int src[]) {int i 0, m n-1, k 0;if (0 > n){return ;}for (i 0; i < n; i){if (0 ! (src[i] % 2))///奇数{dest[k] src[i];k ;}else{de…

MVC(dotnet)

一天中吹牛的时间到了&#xff0c;纠正一下自己的思维&#xff0c;要是能让过客收益那是我的荣幸。 前段时间就三层&MVC被一些网友搅的一头雾水....管他萝卜酸菜吃下去了才是自己的。 首先我要说明的是MVC只是一个表现模式&#xff0c;是一种软件架构模式&#xff0c;而三层…

微信小程序轮播图中间变大_微信小程序实现带放大效果的轮播图

本文实例为大家分享了微信小程序实现带放大效果的轮播图&#xff0c;供大家参考&#xff0c;具体内容如下效果如图WXMLWXSS.Carousel{margin-top: 49px;background-color: #fff;}.swiper-container{position: relative;}.swiper-container .swiper{padding-top: 8px;height: 38…

跟我领导吃饭

上篇文章说&#xff0c;下篇文章会说跟我们领导吃饭的事情。我领导是我上上上家公司的领导&#xff0c;不是现在TC的领导。自从离职后&#xff0c;我们差不多6个月没再见面&#xff0c;那时候我想跳槽&#xff0c;是因为得到消息说他要走&#xff0c;我刚开始不相信&#xff0c…

tyvj 1391 走廊泼水节【最小生成树】By cellur925

题目传送门 题意简化&#xff1a;给你一棵树&#xff0c;要求你加边使它成为完全图&#xff08;任意两点间均有一边相连&#xff09; &#xff0c;满足原来的树是这个图的最小生成树。求加边的价值最小是多少。 考虑Kruskal的过程&#xff0c;我们每次找一条最短的&#xff0c;…

分解成质因数

分解成质因数 (如435234251*17*17*3*2) void prim(int m) {int n 2;if (m > n) {while (m%n ! 0) {n;}m / n;prim(m);printf(“%d*”, n);} }

支持向量机-SVM-最优化公式推导记录

1. 简述 SVM涉及的东西很多&#xff0c;如果要理解全面的话&#xff0c;要理解经验风险与置信风险&#xff0c;VC维理论&#xff0c;推导出最优化公式&#xff0c;最优化求解的拉格朗日解法&#xff0c;核函数&#xff0c;等等方面的内容&#xff0c;当前对SVM理解太少&#xf…