ecs mysql8

To remind me, it is not more than mysql8.0 version of the password policy and change the syntax wrong.

 

Re-operate it again:

#vim /etc/my.cnf

【mysql】

Add skip-grant-table

#systemctl stop mysqld.service

#systemctl start mysqld.service

#mysql –u root

[Hit Enter to enter]

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

 

mysql> alter user 'root'@'localhost'IDENTIFIED BY 'MyNewPass';

ERROR 1819 (HY000): Your password does notsatisfy the current policy requirements

mysql> alter user 'root'@'localhost'IDENTIFIED BY 'MyNewPass@123';

ERROR 1396 (HY000): Operation ALTER USERfailed for 'root'@'localhost'

mysql> alter user'root'@'%' IDENTIFIED BY 'MyNewPass@123'; 

 [Mysql8.0 more sensitive password policy restrictions must add digital special symbols, I modified the previous root password with mysqladmin, set, update, reference before: http: //www.cnblogs.com/liufei88866/p/5619215. html]

Query OK, 0 rows affected (0.05 sec)

Exit, the Skip-grant-table delete statement, restart the database

[Root @ localhost ~] # vim /etc/my.cnf Delete omitted]

[root@localhost ~]# systemctl stopmysqld.service

[root@localhost ~]# systemctl startmysqld.service

[root@localhost ~]# mysql -uroot –p

mysql> CREATE USER dbadmin@localhost

   -> IDENTIFIED BY 'pwd123';

ERROR 1819 (HY000): Your password does notsatisfy the current policy requirements

mysql> CREATE USER dbadmin@localhost

   -> IDENTIFIED BY 'Pwd123';

ERROR 1819 (HY000): Your password does notsatisfy the current policy requirements

mysql> CREATE USER dbadmin@localhost

   -> IDENTIFIED BY 'Pwd@123';

ERROR 1819 (HY000): Your password does notsatisfy the current policy requirements

mysql> CREATE USER dbadmin@localhost

   -> IDENTIFIED BY 'MyNewPass@123';

Query OK, 0 rows affected (0.10 sec)

[You can create a normal user, password security, or the requirements set complexity is higher]

 

 

The second use SQL tool for remote connection, where the use SQLyog for remote connections.

  In general, the direct use of ROOT user's account password to connect is not enough, even if the password is correct.

MYSQL within 8.0 new increase mysql_native_password function to connect remotely to this function by changing the password.

2.1 The first user can change the ROOT password native_password

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY'MyPass@123';

Query OK, 0 rows affected (0.15 sec)

 

2.2 second can increase Root login new user, and then authorize remote connections.

 

mysql> CREATE USER 'super'@'%'IDENTIFIED BY 'MyPass@123';

Query OK, 0 rows affected (0.10 sec)

 

Query OK, 0 rows affe mysql> GRANT ALLON *.* TO 'super'@'%' WITH GRANT OPTION;

Query OK, 0 rows affected (0.10 sec)

 

mysql> Flush privileges;

Query OK, 0 rows affected (0.00 sec)cted(0.01 sec)

 

mysql> ALTER USER 'super'@'%' IDENTIFIEDWITH mysql_native_password BY 'MyPass@123';

Query OK, 0 rows affected (0.10 sec)

 

Note: Changing the password mysql_native_passwd, equivalent to the original user to change the password. MYSQL within 8.0 to mysql-native_passwd mainly from Shell logging in need to pay attention.


----------------
Disclaimer: This article is CSDN bloggers' Oscar Vic chicken apprentice "in the original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/yi247630676/article/details/80352655

Guess you like

Origin www.cnblogs.com/3xiaoleilei/p/11828534.html