Trying to update root password on mysql or create a new user is giving me /mysql/user.MYD error

孤街浪徒 提交于 2021-01-29 08:15:54

问题


I tried to make a mysql_secure_installation but after I enter the password is giving me this:

...Failed! Error: File './mysql/user.MYD' not found (Errcode: 2 - No such file or directory)

Connecting using mysql cli and trying to create a new user gives me the same.

Mysql is 5.7 and installed via Homebrew


回答1:


You haven't initialized the database. Your error means, that the table in which users are stored doesn't exist.

Have a look in your /etc/my.cnf file. There should be an entry datadir. Make sure this directory is empty. Then do

# mysql_install_db --defaults-file=/etc/my.cnf

This creates the schema mysql and all necessary tables. After that you can do

# mysql_secure_installation


来源:https://stackoverflow.com/questions/54293033/trying-to-update-root-password-on-mysql-or-create-a-new-user-is-giving-me-mysql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!