I've just installed MySQL through MySQL Package Installer. After the installation, this message:
我刚刚通过MySQL包安装程序安装了MySQL。安装后,以下消息:
2015-11-19T21:16:59.224430Z 1 [Note] A temporary password is generated for root@localhost: qXkd%pqb)6z3
If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.
Then I've tried to log using Sequel Pro to 127.0.0.1 / root / #<;Ay.
然后我尝试使用Sequel Pro来记录127.0.0.1 / root / #<;Ay。
and this is the result:
结果是:
Your password has expired. To log in you must change it using a client that supports expired passwords.
and this is the result from MySQL WorkBench
这是MySQL WorkBench的结果
Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306:
Your password has expired. Your instance of Connector/C++ is not linked against mysql client library that allows to change it. resetting of an expired password. To resolve this, you either need to change the password with mysql client that can do it or rebuild your instance of Connector/C++ against mysql client library that supports resetting of an expired password.
Please:
1 Check that mysql is running on server 127.0.0.1
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
4 Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from
So I've tried
所以我尝试
1)
1)
`cd /usr/local/mysql/bin`
./mysqladmin -u root password 'password'
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
2)
2)
./mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
3)
3)
/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
4)
4)
cd /usr/local/mysql/bin/
MacBook-Pro-de-nunito:bin nunito$ ./mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 85
Server version: 5.7.9
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> update user set password=PASSWORD("NEW_PASSWORD_HERE") where User='root';
ERROR 1046 (3D000): No database selected
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> USE mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
ERROR 1046 (3D000): No database selected
mysql>
5)
5)
./mysql -u root -h 127.0.0.1 -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
2 个解决方案
#1
3
In the point 4 )
在第4点)
SET PASSWORD = PASSWORD('new_password');
use mysql;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
#2
1
Find out which user the mysql server is running as using ps au | grep mysqld
. sudo
to said user and run update user set password=PASSWORD("NEW_PASSWORD_HERE") where User=user()
. Hope that helps.
了解mysql服务器使用ps au | grep mysqld运行的用户。sudo到该用户并运行update user set password= password(“NEW_PASSWORD_HERE”),其中user =user()。希望有帮助。
#1
3
In the point 4 )
在第4点)
SET PASSWORD = PASSWORD('new_password');
use mysql;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
#2
1
Find out which user the mysql server is running as using ps au | grep mysqld
. sudo
to said user and run update user set password=PASSWORD("NEW_PASSWORD_HERE") where User=user()
. Hope that helps.
了解mysql服务器使用ps au | grep mysqld运行的用户。sudo到该用户并运行update user set password= password(“NEW_PASSWORD_HERE”),其中user =user()。希望有帮助。