尝试在mysql上更新root密码或创建新用户使我/mysql/user.MYD错误 [英] Trying to update root password on mysql or create a new user is giving me /mysql/user.MYD error

查看:74
本文介绍了尝试在mysql上更新root密码或创建新用户使我/mysql/user.MYD错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图制作一个 mysql_secure_installation ,但是输入密码后,密码如下:

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

...失败!错误:找不到文件"./mysql/user.MYD"(错误代码:2-没有此类文件或目录)

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

使用 mysql cli进行连接并尝试创建一个新用户,会给我同样的感觉.

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

Mysql是5.7,并通过Homebrew安装

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.

查看您的/etc/my.cnf文件.应该有一个条目 datadir .确保此目录为空.然后做

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

这将创建模式mysql和所有必要的表.之后,您可以做

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

# mysql_secure_installation

这篇关于尝试在mysql上更新root密码或创建新用户使我/mysql/user.MYD错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆