看到这篇的同学应该是安装了新版本的mysql吧,新版本的mysql的密码初始化方式已经改了,
下面这个log就是安装mysql时候的输出,其中的红字就是密码初始化命令,
Installing MySQL system tables...2020-02-18 00:51:06 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2020-02-18 00:51:06 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2020-02-18 00:51:06 0 [Note] ./bin/mysqld (mysqld 5.6.38-ndb-7.3.19-cluster-gpl) starting as process 1755 ... 2020-02-18 00:51:06 1755 [Note] InnoDB: Using atomics to ref count buffer pool pages 2020-02-18 00:51:06 1755 [Note] InnoDB: The InnoDB memory heap is disabled 2020-02-18 00:51:06 1755 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2020-02-18 00:51:06 1755 [Note] InnoDB: Memory barrier is not used 2020-02-18 00:51:06 1755 [Note] InnoDB: Compressed tables use zlib 1.2.3 2020-02-18 00:51:06 1755 [Note] InnoDB: Using Linux native AIO 2020-02-18 00:51:06 1755 [Note] InnoDB: Using CPU crc32 instructions 2020-02-18 00:51:06 1755 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2020-02-18 00:51:06 1755 [Note] InnoDB: Completed initialization of buffer pool 2020-02-18 00:51:07 1755 [Note] InnoDB: Highest supported file format is Barracuda. 2020-02-18 00:51:07 1755 [Note] InnoDB: 128 rollback segment(s) are active. 2020-02-18 00:51:07 1755 [Note] InnoDB: Waiting for purge to start 2020-02-18 00:51:07 1755 [Note] InnoDB: 5.6.38 started; log sequence number 1626007 2020-02-18 00:51:08 1755 [Note] Binlog end 2020-02-18 00:51:08 1755 [Note] InnoDB: FTS optimize thread exiting. 2020-02-18 00:51:08 1755 [Note] InnoDB: Starting shutdown... 2020-02-18 00:51:10 1755 [Note] InnoDB: Shutdown completed; log sequence number 1626017 OK Filling help tables...2020-02-18 00:51:10 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2020-02-18 00:51:10 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2020-02-18 00:51:10 0 [Note] ./bin/mysqld (mysqld 5.6.38-ndb-7.3.19-cluster-gpl) starting as process 1778 ... 2020-02-18 00:51:10 1778 [Note] InnoDB: Using atomics to ref count buffer pool pages 2020-02-18 00:51:10 1778 [Note] InnoDB: The InnoDB memory heap is disabled 2020-02-18 00:51:10 1778 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2020-02-18 00:51:10 1778 [Note] InnoDB: Memory barrier is not used 2020-02-18 00:51:10 1778 [Note] InnoDB: Compressed tables use zlib 1.2.3 2020-02-18 00:51:10 1778 [Note] InnoDB: Using Linux native AIO 2020-02-18 00:51:10 1778 [Note] InnoDB: Using CPU crc32 instructions 2020-02-18 00:51:10 1778 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2020-02-18 00:51:10 1778 [Note] InnoDB: Completed initialization of buffer pool 2020-02-18 00:51:10 1778 [Note] InnoDB: Highest supported file format is Barracuda. 2020-02-18 00:51:10 1778 [Note] InnoDB: 128 rollback segment(s) are active. 2020-02-18 00:51:10 1778 [Note] InnoDB: Waiting for purge to start 2020-02-18 00:51:10 1778 [Note] InnoDB: 5.6.38 started; log sequence number 1626017 2020-02-18 00:51:10 1778 [Note] Binlog end 2020-02-18 00:51:10 1778 [Note] InnoDB: FTS optimize thread exiting. 2020-02-18 00:51:10 1778 [Note] InnoDB: Starting shutdown... 2020-02-18 00:51:12 1778 [Note] InnoDB: Shutdown completed; log sequence number 1626027 OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: ./bin/mysqladmin -u root password 'new-password' ./bin/mysqladmin -u root -h mysql1 password 'new-password' Alternatively you can run: ./bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd . ; ./bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com WARNING: Found existing config file ./my.cnf on the system. Because this file might be in use, it was not replaced, but was used in bootstrap (unless you used --defaults-file) and when you later start the server. The new default config file was created as ./my-new.cnf, please compare it with your file and take the changes you need.