[英]How to specify default user in mac OS when running the mysql command in terminal?
我在 mac OS Catalina 10.15.2 上使用全新安装的 mysql。 运行命令mysql
或mysql -v
时,我得到以下输出:
ERROR 1045 (28000): Access denied for user 'timothyfisher'@'localhost' (using password: NO)
这是因为在我的情况下,用户没有设置为root
。 MySQL 工作得很好,因为我可以输入mysql -u root
,所以这并没有真正引起任何问题,但它有点烦人。
如何将 mysql 命令设置为使用 root 用户而不是我的计算机用户?
创建文件 ~/.my.cnf 并添加以下行。
[client]
user=<your_user>
password=<your_password>
更多信息可以查看https://easyengine.io/tutorials/mysql/mycnf-preference/ 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.