Home >Database >Mysql Tutorial >Solution to the problem of unsuccessful installation and startup of Mysql5.7.17 under Windows
这篇文章主要介绍了解决Mysql5.7.17在windows下安装启动时提示不成功问题,需要的朋友可以参考下
在机器上首次安装MySQL,
操作系统是win7
mysql 的安装文件是 zip 格式的,版本是5.7.17
解压之后,安装步骤是
1、首先找个文件存放这些安装程序以及 数据
假设是E:\\mysql
2、把解压的文件放在E:\\mysql下,并且新建个data文件夹
3、创建环境变量mysql 路径是E:\\mysql
添加到path 中 %MYSQL%\bin;
4、在解压的文件夹下有个my-default.ini
的文件,首先拷贝一份,重命名为my.ini
修改文件内容
只修改两行就行
basedir = E:\\mysql datadir = E:\\mysql\\data
这两行原先是用#号注释掉的,
5、用系统管理员身份启动命令行
输入mysqld -install
这个是安装mysql 服务的
6、输入 mysqld --initialize
这个是因为 自动5.7.7版本之后,windows安装mysql通过zip解压的方式,不再包含data 文件夹,
如果没有data文件夹,则会在启动mysql服务的时候起不来,观察data文件夹下后缀名是.err的文件就可以发现,会报这么一些错误
MySQL: Table 'mysql.plugin' doesn't exist 2017-01-01T17:13:33.200113Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 2017-01-01T17:13:33.202113Z 0 [Note] Salting uuid generator variables, current_pid: 6908, server_start_time: 1483290810, bytes_sent: 0, 2017-01-01T17:13:33.237115Z 0 [Note] Generated uuid: '9fb87162-d045-11e6-b092-00ff173a9c42', server_start_time: 1483297718, bytes_sent: 114009376 2017-01-01T17:13:33.241115Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9fb87162-d045-11e6-b092-00ff173a9c42. 2017-01-01T17:13:33.248116Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2017-01-01T17:13:33.250116Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key 2017-01-01T17:13:33.254116Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 2017-01-01T17:13:33.259116Z 0 [Note] IPv6 is available. 2017-01-01T17:13:33.260117Z 0 [Note] - '::' resolves to '::'; 2017-01-01T17:13:33.261117Z 0 [Note] Server socket created on IP: '::'. 2017-01-01T17:13:33.266117Z 0 [Warning] Failed to open optimizer cost constant tables 2017-01-01T17:13:33.268117Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 2017-01-01T17:13:33.270117Z 0 [ERROR] Aborting
其实这是因为这些表示放在data文件夹下的,所以我们需要先执行命令mysqld -initialize
在完成mysql 的初始化,这样的话,mysql会自动完成一些初始化的工作
7、启动服务 net start mysql
The above is the detailed content of Solution to the problem of unsuccessful installation and startup of Mysql5.7.17 under Windows. For more information, please follow other related articles on the PHP Chinese website!