简体   繁体   中英

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM