启动出错
解决办法
执行mysqld --install,查看是否已经安装成功
删除 mysqld -remove mysql
重新执行mysqld --install
启动服务net start mysql
服务依旧是启动不了。
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
[ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
[ERROR] Aborting
第一个错误可以看到这里少了一个mysql.plugin的表;
第二个错误是少了mysql.user表;
解决方法:
1、去C:\Program Files\MySQL\MySQL Server 5.7\bin目录下创建my.ini文件,内容如下:
[mysqld]
basedir=C:\Program Files\MySQL\MySQL Server 5.7
datadir=C:\Program Files\MySQL\MySQL Server 5.7\data
2、清空C:\Program Files\MySQL\MySQL Server 5.7\data目录,里面的信息一会通过命令会自动生成的;
3、执行 mysqld --initialize --user=mysql --console
4、启动成功;
-------------------------
You must reset your password using ALTER USER statement before executing this statement.
登录mysqlmysql -uroot -p# alter方式修改ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; //记得修改自己的账户
flush privileges; //修改成功后刷新权限
set方式修改
set password for root@localhost = password('123456'); //记得修改自己的账户
flush privileges; //修改成功后刷新权限