通过 homebrew 新装了 mariadb
然后通过 mysql -u root
登录用户后,发现无论执行什么命令都没有任何权限。报错如下
WARNING: The host 'YangdeMacBook-Pro.local' could not be looked up with /usr/local/Cellar/mariadb/10.3.9/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 ! Installing MariaDB/MySQL system tables in '/usr/local/var/mysql' ... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following commands: '/usr/local/Cellar/mariadb/10.3.9/bin/mysqladmin' -u root password 'new-password' '/usr/local/Cellar/mariadb/10.3.9/bin/mysqladmin' -u root -h YangdeMacBook-Pro.local password 'new-password' Alternatively you can run: '/usr/local/Cellar/mariadb/10.3.9/bin/mysql_secure_installation' which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the MariaDB Knowledgebase at http://mariadb.com/kb or the MySQL manual for more instructions. You can start the MariaDB daemon with: cd '/usr/local/Cellar/mariadb/10.3.9' ; /usr/local/Cellar/mariadb/10.3.9/bin/mysqld_safe --datadir='/usr/local/var/mysql' You can test the MariaDB daemon with mysql-test-run.pl cd '/usr/local/Cellar/mariadb/10.3.9/mysql-test' ; perl mysql-test-run.pl Please report any problems at http://mariadb.org/jira The latest information about MariaDB is available at http://mariadb.org/. You can find additional information about the MySQL part at: http://dev.mysql.com Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/
最近新装的 MySQL 和 MariaDB 都会偶尔抽风的出现这个问题。
问题出现的原因是 /usr/local/Cellar/mariadb/10.3.9/bin/resolveip
无法正确解析 localhost
解决办法有两个:
- 重启,万能的 bug 修复方案,只要重启就能解决
-
或者,直接运行下面的命令先解析下 localhost 是否正常
/usr/local/Cellar/mariadb/10.3.9/bin/resolveip localhost
如果正常,那么重启 MySQL 服务器即可
目前尚无回复