Please forgive me for being a complete beginner:
请原谅我是一个完全的初学者:
I am trying to log into my very first mySQL database that I installed using easyPHP on my windows machine, using the cmd line. I am going to the \mysql\bin and entering the command:
我正在尝试登录我在windows机器上使用easyPHP安装的第一个mySQL数据库,使用cmd行。我将转到\mysql\bin并输入命令:
mysql -u root
in order to log in, but I am getting the following message:
为了登录,我得到以下信息:
error 1045 (28000) access denied for user 'root'@'localhost' (using password: YES)
Why is it using the password "YES"? Shouldn't there be no password at all? Do I need to restart mySQL or something? If so, how do I do that? If it's relevant, I did try to create the database using phpmyadmin, but had a few problems entering columns and decided I'd be better off working from the command line so I could learn all the commands as I went along.
为什么它使用密码“YES”?难道根本就没有密码吗?我需要重启mySQL还是什么?如果是的话,我该怎么做呢?如果相关的话,我确实尝试过使用phpmyadmin创建数据库,但是在输入列时遇到了一些问题,因此我决定最好从命令行开始工作,这样我就可以在进行时学习所有的命令。
Please keep in mind that this is my first time ever trying to work with a database, so be kind to me!
请记住,这是我第一次尝试使用数据库,所以请善待我!
4 个解决方案
#1
7
To have mysql asking you for a password, you also need to specify the -p
-option:
要让mysql要求您输入密码,您还需要指定-p选项:
mysql -u root -p
#2
3
When logging into MYSQL using the command line, you also have to specify the password if any. Your error message is telling you that the user "root" has a password attached to it. Not necessarily that the password is "YES" when you were installing easyPHP, it should have either provided you with a default password or allowed you to enter a password of your choosing.
当使用命令行登录到MYSQL时,您还必须指定密码。您的错误消息告诉您,用户“root”附加了一个密码。在安装easyPHP时,密码不一定是“YES”,它应该为您提供默认密码,或者允许您输入自己选择的密码。
According to the documentation of easyPHP:
根据easyPHP文档:
[v1.6] My scripts worked perfectly with 1.5 but now I get this error : Warning: Forbidden access for user: 'user@localhost' (password: YES) when I want to connect to MySql.
[v1.6]我的脚本在使用1.5时运行良好,但是现在我得到了这个错误:警告:当我想连接到MySql时,用户“user@localhost”(密码:YES)被禁止访问。
Only the root user (without password) has the rights to connect to the database. Either modify your scripts to use it, or add the user you need (phpMyAdmin/users and privileges: See phpMyAdmin's documentation for more information).
只有根用户(没有密码)有权连接到数据库。要么修改您的脚本以使用它,要么添加您需要的用户(phpMyAdmin/users和特权:更多信息请参见phpMyAdmin的文档)。
mysql -u root -p
mysql - u root - p
Now if you changed your root user password, you will need to specify that when prompted. Otherwise simply hit <Enter>
on your keyboard.
现在,如果您更改了根用户密码,您将需要在提示时指定该密码。否则,只需在键盘上输入 <输入> 。
If you FORGOT the password to root, and have changed it, you will have to subsequently reinstall easyPHP.
如果您忘记了root用户的密码,并对其进行了修改,那么您必须随后重新安装easyPHP。
#3
0
agk-hp:~/$mysql
ERROR 1045 (28000): Access denied for user 'greg'@'localhost' (using password: NO)
agk-hp:~/$sudo cat /etc/mysql/debian.cnf|grep password
password = t7753my3D2x4yfQm
agk-hp:~/$mysql -u debian-sys-maint -p
Enter password: {t7753my3D2x4yfQm}
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> use mysql;
mysql> grant all privileges on *.* to 'root'@'localhost';
mysql> grant all privileges on *.* to 'greg'@'localhost';
agk-hp:~/$mysql
mysql>
#4
0
A modification for mysql- 5.7.10 on mac mac el capitan
mac mac mac el capitan对mysql- 5.7.10的修改
- sudo /usr/local/mysql/support-files/mysql.server stop
- sudo /usr/local/mysql/support-files / mysql。服务器停止
-
sudo mysqld_safe --skip-grant-tables
sudo mysqld_safe——skip-grant-tables
Now open new window/tab on terminal and type
现在在终端上打开新的窗口/选项卡并输入
- "mysql -u root"
- “mysql - u根”
- use mysql
- 使用mysql
- update user set authentication_string=password('yourpassword') where user='root';
- 更新用户设置authentication_string=password('yourpassword'),其中user='root';
#1
7
To have mysql asking you for a password, you also need to specify the -p
-option:
要让mysql要求您输入密码,您还需要指定-p选项:
mysql -u root -p
#2
3
When logging into MYSQL using the command line, you also have to specify the password if any. Your error message is telling you that the user "root" has a password attached to it. Not necessarily that the password is "YES" when you were installing easyPHP, it should have either provided you with a default password or allowed you to enter a password of your choosing.
当使用命令行登录到MYSQL时,您还必须指定密码。您的错误消息告诉您,用户“root”附加了一个密码。在安装easyPHP时,密码不一定是“YES”,它应该为您提供默认密码,或者允许您输入自己选择的密码。
According to the documentation of easyPHP:
根据easyPHP文档:
[v1.6] My scripts worked perfectly with 1.5 but now I get this error : Warning: Forbidden access for user: 'user@localhost' (password: YES) when I want to connect to MySql.
[v1.6]我的脚本在使用1.5时运行良好,但是现在我得到了这个错误:警告:当我想连接到MySql时,用户“user@localhost”(密码:YES)被禁止访问。
Only the root user (without password) has the rights to connect to the database. Either modify your scripts to use it, or add the user you need (phpMyAdmin/users and privileges: See phpMyAdmin's documentation for more information).
只有根用户(没有密码)有权连接到数据库。要么修改您的脚本以使用它,要么添加您需要的用户(phpMyAdmin/users和特权:更多信息请参见phpMyAdmin的文档)。
mysql -u root -p
mysql - u root - p
Now if you changed your root user password, you will need to specify that when prompted. Otherwise simply hit <Enter>
on your keyboard.
现在,如果您更改了根用户密码,您将需要在提示时指定该密码。否则,只需在键盘上输入 <输入> 。
If you FORGOT the password to root, and have changed it, you will have to subsequently reinstall easyPHP.
如果您忘记了root用户的密码,并对其进行了修改,那么您必须随后重新安装easyPHP。
#3
0
agk-hp:~/$mysql
ERROR 1045 (28000): Access denied for user 'greg'@'localhost' (using password: NO)
agk-hp:~/$sudo cat /etc/mysql/debian.cnf|grep password
password = t7753my3D2x4yfQm
agk-hp:~/$mysql -u debian-sys-maint -p
Enter password: {t7753my3D2x4yfQm}
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> use mysql;
mysql> grant all privileges on *.* to 'root'@'localhost';
mysql> grant all privileges on *.* to 'greg'@'localhost';
agk-hp:~/$mysql
mysql>
#4
0
A modification for mysql- 5.7.10 on mac mac el capitan
mac mac mac el capitan对mysql- 5.7.10的修改
- sudo /usr/local/mysql/support-files/mysql.server stop
- sudo /usr/local/mysql/support-files / mysql。服务器停止
-
sudo mysqld_safe --skip-grant-tables
sudo mysqld_safe——skip-grant-tables
Now open new window/tab on terminal and type
现在在终端上打开新的窗口/选项卡并输入
- "mysql -u root"
- “mysql - u根”
- use mysql
- 使用mysql
- update user set authentication_string=password('yourpassword') where user='root';
- 更新用户设置authentication_string=password('yourpassword'),其中user='root';