所以我基本上是在我的 mac 上使用 Homebrew 软件安装 mariadb 和 mysql。 这些是我执行的步骤:
- brew 博士 -> 工作过
- brew update -> 成功了
- brew install mariadb -> 成功了
mysql_install_db -> 失败
WARNING: The host 'Toms-MacBook-Pro.local' could not be looked up with /usr/local/Cellar/mariadb/10.4.6_1/bin/resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MariaDB version. The MariaDB daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MariaDB privileges ! mysql.user table already exists!
之后运行 mysql_upgrade
出现以下错误:
Version check failed. Got the following error when calling the 'mysql' command line client ERROR 1698 (28000): Access denied for user 'root'@'localhost' FATAL ERROR: Upgrade failed
我不能这样进入mysql:
mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
但是像这样:
sudo mysql -u root
用户表返回这个:
MariaDB [(none)]> USE mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> SELECT User, Host, plugin FROM mysql.user;
+---------------+-------------------------+-----------------------+
| User | Host | plugin |
+---------------+-------------------------+-----------------------+
| root | localhost | mysql_native_password |
| toms | localhost | mysql_native_password |
| | localhost | |
| | toms-macbook-pro.local | |
+---------------+-------------------------+-----------------------+
4 rows in set (0.004 sec)
最佳答案
您可以尝试更新 root 密码并在之后访问它
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
退出Mysql并尝试登录
mysql -uroot -p # then use root as a password
关于mysql - Homebrew Mariadb Mysql 安装 root 访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57803604/