MySql Service 安装流程,包含解决服务无法启动 服务没有报告任何错误

来源:互联网 发布:dmx控制器淘宝 编辑:程序博客网 时间:2024/05/23 13:46

今天在自己电脑上下载了mysql的压缩包,不是安装版的,而是压缩版的,我的版本是mysql-5.7.12-winx64.zip。

下载下来后,直接解压即可。

然后修改文件my-default.ini。具体的配置可以网上找,我也是网上找的。如下

# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.7/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]port = 3306basedir=F:\tools\MysqlService\mysqldatadir=F:\tools\MysqlService\mysql\datadefault-storage-engine=INNODBsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLESmax_connections=100character-set-server=utf8# 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 = F:\tools\MysqlService\mysql#datadir = F:\tools\MysqlService\mysql\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
主要还是配置basedir和datadir两个配置。(网上说可以自己配置my.ini,但是我配置后报错,没有找到错误原因,所以直接在default中改了)。

改完后,以管理员身份打开cmd.exe命令提示符(快捷键win+x,然后ctrl+a即可)。

cd 到你的解压目录,比如我的是在 F:\tools\MysqlService\mysql 下,那么需要cd 到这个目录的bin下边。

然后运行 mysqld -install ,成功后执行mysqld --initialize-insecure 会初始化你的data文件夹内的内容(这个命令就是能解决按照百度经验中的方式安装却启动不了命令的错误的解决办法,具体的说明地址:http://bbs.csdn.net/topics/391851148?page=2 。68楼写的是正确的命令,前边说明了这么做的原因。)

最后运行net start mysql,服务启动成功!!!

0 0