香港服务器Windows下安装MySQL 5.7.17压缩版后无法启动,错误1067:进程意外终止
首先下载最新的MySQL 5.7.17 Community 压缩版 for Windows 64-bit:
然后解压到安装目录(如C:ProgMySQL)。接下来复制my-default.ini为my.ini,修改my.ini如下:
[mysql]
default-character-set=utf8mb4
[mysqld]
basedir = C:ProgMySQL
datadir = C:ProgMySQLdata
port = 3306
max_connections=200
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
default-storage-engine=INNODB
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
之后用“管理员身份”打开cmd,进入安装目录安装MySQL服务:
C:ProgMySQLin>mysqld install
Service successfully installed.
然后启动MySQL服务:
net start mysql
刚开始以为就这么简单,可是却报错了:
如果是通过Windows系统的“服务”启动,则提示:
查了许久,原来是:
If you installed MySQL using the Noinstall package, you may need to initialize the data directory:
1.Windows distributions prior to MySQL 5.7.7 include a data directory with a set of preinitialized accounts in the mysql database.
2.As of 5.7.7, Windows installation operations performed using the Noinstall package do not include a data directory. To initialize the data directory, use the instructions at Section 2.10.1.1, “Initializing the Data Directory Manually Using mysqld”.
具体可参考这两个链接:
http://www.landui.com/doc/refman/5.7/en/windows-initialize-data-directory.html
http://www.landui.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html
原因找到了,那我们来手动Initialize Data Directory一下啊:
mysqld --defaults-file=C:ProgMySQLmy.ini --initialize-insecure
然后依次:
net start mysql
mysql -u root -p
应该就出来了。
希望对遇到的人有所帮助,究其原因就是5.7.7及?后的压缩包版本,更改为需要手动Initialize Data Directory了。
一诺网络香港免备案专区,提供「香港增强VPS」和「香港特惠VPS」两种类型的高可用弹性计算服务,搭载新一代英特尔®至强®铂金处理器,接入CN2低延时高速回国带宽线路,网络访问顺滑、流畅。机房网络架构采用了BGP协议的解决方案可提供多线路互联融合网络,使得不同网络运营商线路的用户都能通过最佳路由实现快速访问。香港云VPS低至29元/月,购买链接:https://www.enuoidc.com/vps.html?typeid=2