报错提示:
[root@hecs-399223 bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
mysqld: Can't change dir to '/usr/local/mysql/data/' (Errcode: 13 - Permission denied)
2023-10-27T06:21:51.170236Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-10-27T06:21:51.171947Z 0 [ERROR] failed to set datadir to /usr/local/mysql/data/
2023-10-27T06:21:51.171962Z 0 [ERROR] Aborting
解决方案:
[root@hecs-399223 bin]# chmod -R 777 /usr/local/mysql/data/
再次执行mysql数据库初始化(成功执行)
[root@hecs-399223 bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2023-10-27T06:29:18.581041Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-10-27T06:29:18.826360Z 0 [Warning] InnoDB: New log files created, LSN=45790
2023-10-27T06:29:18.868528Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2023-10-27T06:29:18.928878Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 288aaf07-7492-11ee-8151-fa163e92ea6c.
2023-10-27T06:29:18.931018Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2023-10-27T06:29:19.409290Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-10-27T06:29:19.409316Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-10-27T06:29:19.409839Z 0 [Warning] CA certificate ca.pem is self signed.
2023-10-27T06:29:19.670575Z 1 [Note] A temporary password is generated for root@localhost: Y2Eu.8du7Fi<
[root@hecs-399223 bin]#