解决Mysql5.7.17在windows下安装启动时提示不成功问题
程序员文章站
2023-01-10 14:54:02
在机器上首次安装mysql,
操作系统是win7
mysql 的安装文件是 zip 格式的,版本是5.7.17
解压之后,安装步骤是
1、首先找个文件存放这些安装程...
在机器上首次安装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
以上所述是小编给大家介绍的解决mysql5.7.17在windows下安装启动时提示不成功问题,希望对大家有所帮助