在机器上首次安装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 文件夹,这个可以参考官网的介绍
http://dev.mysql.com/doc/refman/5.7/en/windows-initialize-data-directory.html
如果没有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
以上所述是小编给大家介绍的解决Mysql5.7.17在windows下安装启动时提示不成功问题,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
您可能感兴趣的文章:- windows10安装mysql5.7.17教程
- mysql5.7安装教程(windows)
- windows下修改Mysql5.7.11初始密码的图文教程
- 全面解析Windows下安装 mysql5.7的方法
- mysql5.7.13.zip安装教程(windows)