z

这两天为了完成数据库的实践作业,操作下mysql。之前用的都是5.7版本,想着8.0出这么久了用用吧, 于是亲自买入了坑中。

第一个坑,安装的时候设置好了密码,登陆的时候一直提示登陆失败。可能是权限的问题,5.7版本都是用skip-grant-tables跳过认证直接登陆然后改密码。8.0也这样操作,但是问题来了。首先我们捋一下流程:

  • window修改my.ini文件
  • mysqld下加入skip-grant-tables
  • 重启服务
  • cmdmysql -uroot直接登陆

问题就出在重启服务那里。要么重启失败,要么成功之后它会自动停止。原因就在于官网对mysql8.0的一个改动

1
If the server is started with the --skip-grant-tables option to disable authentication checks, the server enables --skip-networking automatically to prevent remote connections.

也就是说,如果设置了skip-grant-tables,那么为了确保安全会断开服务等等。

那么有什么解决办法呢?

有的,加一个shared-memory