1、初始安装的mysql数据库默认设置了root用户密码,必须要修改密码之后才能够使用。
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
2、先通过grep查找获取root密码,进入数据库修改初始密码。
[root@host54 opt]# grep password /var/log/mysqld.log
2018-07-17T11:40:19.847141Z 1 [Note] A temporary password is generated for root@localhost: 2wieko:N1(,#
[root@host54 opt]# mysql -uroot -p'2wieko:N1(,#'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.17
Copyright (c) 2000, 2016, 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 &#