The following link at the end of the post was helpful but can someone clarify this. There are 2 answers that are in complete conflict so I am asking about it.
下面的链接是有用的,但是有人可以澄清这一点。有两个答案是完全冲突的,所以我要问这个问题。
One person responds that you should get to the MySQL command line like this Navigate to the directory
一个人回答说,你应该访问MySQL命令行,就像这样导航到目录
/usr/local/mysql/bin
And and at unix prompt type:
和unix提示符类型:
Macbookpro$./mysql
Then type the following to reset the password.
然后输入以下命令来重置密码。
mysql -u root -p
But then another person says:
但是另一个人说
"No, you should run mysql -u root -p in bash, not at the MySQL command-line. If you are in mysql, you can exit by typing exit."
“不,您应该在bash中运行mysql -u root -p,而不是在mysql命令行中。如果你在mysql中,你可以通过输入exit退出。
Neither of these work for me. First method From the bash prompt:
这些对我都不起作用。bash提示符中的第一种方法:
$macbookpro mysql -u root -p
Enter password: xxxx
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Second method from mysql> prompt
第二个方法来自mysql>提示符
mysql> -u root -p
->
I also often get this error: -bash command not found
我也经常会得到这个错误:-bash命令没有找到。
I am unable to login to phpMyAdmin. Thanks.
我无法登录到phmypadmin。谢谢。
My problem is that I am getting this error message when trying to login to phpMyAdmin. "Login without a password is forbidden by configuration"
我的问题是,当我尝试登录到phpMyAdmin时,我收到了这个错误消息。“配置禁止无密码登录”
The link that in have referenced above. Responses from 2013
上面引用的链接。从2013年开始反应
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db'
错误1044(42000):用户“@'localhost”访问数据库“db”被拒绝
2 个解决方案
#1
37
To use command i.e. $mysql on macbook terminal you need to export path using:
要使用命令,即在macbook终端上使用$mysql,您需要使用以下命令导出路径:
export PATH=$PATH:/usr/local/mysql/bin/
considering default installation use following command to get mysql prompt as root user:
考虑到默认安装,使用以下命令获得mysql提示作为根用户:
mysql -u root
otherwise you are using wrong root password.
否则,您正在使用错误的根密码。
Ref: Setting the MySQL root user password on OS X
Ref:在OS X上设置MySQL根用户密码。
#2
4
For a Permanent Solution -
对于一个永久的解决方案-
-
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
-
. ~/.bash_profile
。~ / . bash_profile
Refer to details at this link.
请参阅此链接的详细信息。
#1
37
To use command i.e. $mysql on macbook terminal you need to export path using:
要使用命令,即在macbook终端上使用$mysql,您需要使用以下命令导出路径:
export PATH=$PATH:/usr/local/mysql/bin/
considering default installation use following command to get mysql prompt as root user:
考虑到默认安装,使用以下命令获得mysql提示作为根用户:
mysql -u root
otherwise you are using wrong root password.
否则,您正在使用错误的根密码。
Ref: Setting the MySQL root user password on OS X
Ref:在OS X上设置MySQL根用户密码。
#2
4
For a Permanent Solution -
对于一个永久的解决方案-
-
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
-
. ~/.bash_profile
。~ / . bash_profile
Refer to details at this link.
请参阅此链接的详细信息。