查看密碼:grep "root@localhost" /var/log/mysqld.log
[root@localhost flyer]# grep "root@localhost" /var/log/mysqld.log
2020-01-15T17:36:06.655549Z 1 [Note] A temporary password is generated for root@localhost: Do/wM!(5:j5N
[root@localhost flyer]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.20
Copyright (c) 2000, 2017, 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>
mysql: 修改密碼 mysql> alter user 'root'@'localhost' IDENTIFIED BY 'root'
mysql> alter user 'root'@'localhost' IDENTIFIED BY 'root'
-> ;
Query OK, 0 rows affected (0.00 sec)
查看mysql字符集: show variables like '%char%';
mysql> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.02 sec)