Mac에 설치 한 후 ALTER USER 문을 사용하여 MySQL 루트 비밀번호 재설정
나는 전체 Mac 경험을 처음 사용합니다. 최근에 MySQL을 설치했으며 설치 후 비밀번호를 재설정해야합니다. 다른 일을 할 수 없습니다.
이제 평소와 같이 비밀번호를 재설정했습니다.
update user set password = password('XXX') where user = root;
(BTW : 기괴한 이유로 MySQL을 해결하기 위해 나이가 들었습니다 .'password '필드의 이름을'authentication_string '으로 바꿨습니다. 그런 변화에 대해 상당히 화가났습니다.)
불행히도 암호를 다른 방법으로 변경 해야하는 것으로 보입니다. 여기 누군가가 이미 그 문제를 겪었 을까요?
mysql> UPDATE mysql.user SET Password=PASSWORD('your_new_password')
WHERE User='root';
오류 1820 (HY000) :이 문을 실행하기 전에 ALTER USER 문을 사용하여 비밀번호를 재설정해야합니다.
mysql> SET PASSWORD = PASSWORD('your_new_password');
쿼리 OK, 영향을받는 행 0 개, 경고 1 개 (0.01 초)
이것은 내가 대답을 찾은 곳입니다 : https://dev.mysql.com/doc/refman/5.6/en/alter-user.html
사용하여 mysql을 시작한 경우 mysql -u root -p
시험 ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
출처 : http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
Mac에서도 같은 문제가 있습니다
먼저 샌드 박스 모드로 mysql에 로그인하십시오.
mysql -u <user> -p --connect-expired-password
그런 다음 비밀번호를 설정하십시오.
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('XXXX');
Query OK, 0 rows affected, 1 warning (0.01 sec)
그것은 나를 위해 작동 ~
MySQL 5.7.6 이상을 사용하는 경우 :
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 이하를 사용하는 경우 :
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
다음을 실행하십시오.
$ cd /usr/local/mysql/bin
$ ./mysqladmin -u root password 'password'
그런 다음 실행
./mysql -u root
로그인해야합니다. 이제 FLUSH 권한을 실행하십시오.
그런 다음 MySQL 콘솔을 종료하고 로그인을 시도하십시오. 그래도 작동하지 않으면 다음을 실행하십시오.
$ mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET authentication_string=PASSWORD("XXXXXXX") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
xxxxxx를 새 비밀번호로 변경하십시오. 그런 다음 다시 로그인하십시오.
최신 정보. 이것을 참조하십시오 http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
문제를 해결해야합니다.
당신이 오라클에 있다면 이것을 시도하십시오
ALTER USER username IDENTIFIED BY password
MySQL 5.7.x에서는 다음과 같이 비밀번호를 변경할 수 있도록 기본 비밀번호로 전환해야합니다.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';
어쩌면 그것을 시도?
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('XXX');
또는
SET PASSWORD FOR 'root'@'%' = PASSWORD('XXX');
사용하는 액세스 권한에 따라 다릅니다.
(그리고 자신을 필드 이름으로 변경 해야하는지 확실하지 않습니다 ...)
https://dev.mysql.com/doc/refman/5.0/en/set-password.html
ALTER USER 'root'@ 'localhost' 'new_password'에 의해 식별 됨;
이 줄을 사용하십시오 ...
에 Ver 14.14 Distrib 5.7.19, for macos10.12 (x86_64)
: 나는로 로그인 mysql -uroot -p
당신이 그것을 설치할 때 다음의 MySQL에 의해 생성 된 암호를 입력했습니다. 그때..
ALTER USER 'root'@'localhost' IDENTIFIED BY '<new_password>';
예:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Ab1234'; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye $ mysql -uroot -p
'Ab1234'를 입력해도됩니다
UPDATE user SET authentication_string=PASSWORD("MyPassWord") WHERE User='root'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '("MyPassWord") WHERE User='root'' at line 1
Resolved with
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
Reference from below site
https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html
This worked for me:
ALTER USER USER() IDENTIFIED BY 'auth_string';
I found it here: http://dev.mysql.com/doc/refman/5.7/en/alter-user.html#alter-user-current
Mysql 5.7.24 get root first login
step 1: get password from log
grep root@localhost /var/log/mysqld.log
Output
2019-01-17T09:58:34.459520Z 1 [Note] A temporary password is generated for root@localhost: wHkJHUxeR4)w
step 2: login with him to mysql
mysql -uroot -p'wHkJHUxeR4)w'
step 3: you put new root password
SET PASSWORD = PASSWORD('xxxxx');
you get ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
how fix it?
run this SET GLOBAL validate_password_policy=LOW;
Try Again SET PASSWORD = PASSWORD('xxxxx');
When you use SET PASSWORD = PASSWORD('your_new_password');
it may crash for it
(ERROR 1819 (HY000): Your password does not satisfy the current policy requirements)
.you can use SET GLOBAL validate_password_policy=LOW;
to slove it.
Here is the way works for me.
mysql> show databases ;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> uninstall plugin validate_password;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user 'root'@'localhost' identified by 'root';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
in 5.7 version. 'password' field has been deleted. 'authentication_string' replace it
use mysql;
update user set authentication_string=password('123456') where user='root';
flush privileges;
I also got the same problem in mac OS X 10.10.4(Yosemite).SET PASSWORD work for me.Alter password for mysql- mysql> SET PASSWORD = PASSWORD('your_password'); Query OK, 0 rows affected, 1 warning (0.01 sec)
set your Mysql environment path variable in .bash_profile and add the below line
export PATH=$PATH:/usr/local/mysql/bin, after that, run the following command :source .bash_profile
Had the problem after I installed mysql workbench and mysql community server. Got generated password during the server installation. Double clicking on the exisiting local instance in workbench triggered a dialog where I could set the new password.
mysql> SET PASSWORD = PASSWORD('your_new_password');
That works for me.
remember versions 5.7.23 and up - the user table doesn't has column password instead authentication string so below works while resetting password for a user.
update user set authentication_string=password('root') where user='root';
'IT story' 카테고리의 다른 글
JqGrid로 select2 드롭 다운의 선택된 값을 어떻게 변경합니까? (0) | 2020.05.23 |
---|---|
PHP에서 임의의 비밀번호 생성 (0) | 2020.05.23 |
인라인 어셈블리 언어가 네이티브 C ++ 코드보다 느립니까? (0) | 2020.05.23 |
UIImage를 90도 회전하는 방법? (0) | 2020.05.23 |
Swift 3에서 상태 표시 줄 스타일을 설정하는 방법 (0) | 2020.05.23 |