关于mysql-5.7.9-winx64以及其他系列安装的问题解决

来源:互联网 发布:java输出换行代码 编辑:程序博客网 时间:2024/06/06 07:27
官网下载的mysql5.7 没有data目录,需要初始化一下。
我的步骤如下(使用的mysql-5.7.9):
1、修改my.ini,配置好data目录,放到bin路径 下:
     min.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]

# 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 =D:\Program Files\MySQL\MySQL Server 5.7
datadir =D:\Program Files\MySQL\MySQL Server 5.7\data
port =3306
# 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 = 512M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
----------------------------------------------------------------------------------------------
2、执行:mysqld --initialize --user=mysql --console
    会自动生成data目录,还有一个随机密码,记下来。
3、执行:mysqld --console 启动mysql,登录mysql -uroot -p 输入刚才记录的密码,执行:set password = password('root')修改密码。
4/杀掉mysqld进程。
安装服务,执行:mysqld --install MySQL --defaults-file="E:\mysql-5.7.9-winx64\my.ini" 自动修改路径 。
net start mysql
ok!
*********************************************************
问题:
输入net start mysql时如果出现的问题:
-------------------------------------------------------------------

C:\Windows\system32>net start mysql
MySQL 服务正在启动 .
MySQL 服务无法启动。

服务没有报告任何错误。

请键入 NET HELPMSG 3534 以获得更多的帮助。
-------------------------------------------------------------------
 在mysql根目录下要配置一个my.ini文件其中有一项为:
datadir =
后面需要加一个根目录下的data文件的路径;
问题就出在这!!!!!!
有的人是自己新建一个data文件然而会出现如上错误;
并且当你输入 mysqld --console查看日志文件时会发现有好多错误;
解决方法:
要先用mysqld  --initialize 先初始化data目录,你会发现data文件生成了,并且里面还多了好多文件,(并不像我们刚建自己建立的那个data文件夹那样空空如也);、
再去运行net start mysql 就可以正常启动了;

0 0
原创粉丝点击