问题
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